From 4edca57eea4715f3af665e139b2ce35245f26abd Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 21 Sep 2022 01:42:45 +0300 Subject: [PATCH] rcm install script env RCRC=/dev/null rcup -B 0 -g > install.sh --- install.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..d7f442d --- /dev/null +++ b/install.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# +# Usage: +# +# sh install.sh +# +# Environment variables: VERBOSE, CP, LN, MKDIR, RM, DIRNAME. +# +# env VERBOSE=1 sh install.sh +# +# DO NOT EDIT THIS FILE +# +# This file is generated by rcm(7) as: +# +# rcup -B 0 -g +# +# To update it, re-run the above command. +# +: ${VERBOSE:=0} +: ${CP:=/bin/cp} +: ${LN:=/bin/ln} +: ${MKDIR:=/bin/mkdir} +: ${RM:=/bin/rm} +: ${DIRNAME:=/usr/bin/dirname} +verbose() { + if [ "$VERBOSE" -gt 0 ]; then + echo "$@" + fi +} +handle_file_cp() { + if [ -e "$2" ]; then + printf "%s " "overwrite $2? [yN]" + read overwrite + case "$overwrite" in + y) + $RM -rf "$2" + ;; + *) + echo "skipping $2" + return + ;; + esac + fi + verbose "'$1' -> '$2'" + $MKDIR -p "$($DIRNAME "$2")" + $CP -R "$1" "$2" +} +handle_file_ln() { + if [ -e "$2" ]; then + printf "%s " "overwrite $2? [yN]" + read overwrite + case "$overwrite" in + y) + $RM -rf "$2" + ;; + *) + echo "skipping $2" + return + ;; + esac + fi + verbose "'$1' -> '$2'" + $MKDIR -p "$($DIRNAME "$2")" + $LN -sf "$1" "$2" +} +handle_file_ln "/Users/ivuorinen/.dotfiles/Brewfile" "/Users/ivuorinen/.Brewfile" +handle_file_ln "/Users/ivuorinen/.dotfiles/alias" "/Users/ivuorinen/.alias" +handle_file_ln "/Users/ivuorinen/.dotfiles/bash_profile" "/Users/ivuorinen/.bash_profile" +handle_file_ln "/Users/ivuorinen/.dotfiles/bashrc" "/Users/ivuorinen/.bashrc" +handle_file_ln "/Users/ivuorinen/.dotfiles/config/antigen.zsh" "/Users/ivuorinen/.config/antigen.zsh" +handle_file_ln "/Users/ivuorinen/.dotfiles/config/gh/config.yml" "/Users/ivuorinen/.config/gh/config.yml" +handle_file_ln "/Users/ivuorinen/.dotfiles/gitconfig" "/Users/ivuorinen/.gitconfig" +handle_file_ln "/Users/ivuorinen/.dotfiles/gitignore_global" "/Users/ivuorinen/.gitignore_global" +handle_file_ln "/Users/ivuorinen/.dotfiles/huskyrc" "/Users/ivuorinen/.huskyrc" +handle_file_ln "/Users/ivuorinen/.dotfiles/install.sh" "/Users/ivuorinen/.install.sh" +handle_file_ln "/Users/ivuorinen/.dotfiles/vuerc" "/Users/ivuorinen/.vuerc" +handle_file_ln "/Users/ivuorinen/.dotfiles/zshrc" "/Users/ivuorinen/.zshrc"