diff options
author | June McEnroe <june@causal.agency> | 2016-04-06 20:53:14 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2016-04-06 20:53:14 -0400 |
commit | 0be154c654ef425a33b6f129b8747fabdfa17e2e (patch) | |
tree | 1b27d464448ed2a0d8577f6554aea7ed88a40b92 | |
parent | Add gpg-agent to README (diff) | |
download | src-0be154c654ef425a33b6f129b8747fabdfa17e2e.tar.gz src-0be154c654ef425a33b6f129b8747fabdfa17e2e.zip |
Simplify install script
Diffstat (limited to '')
-rwxr-xr-x | import.sh | 3 | ||||
-rwxr-xr-x | install.sh | 30 | ||||
-rwxr-xr-x | prune.sh | 2 |
3 files changed, 24 insertions, 11 deletions
diff --git a/import.sh b/import.sh index f1cc0e37..66dde777 100755 --- a/import.sh +++ b/import.sh @@ -2,7 +2,7 @@ # Import a file from ~ and replace it with a symlink. -set -e +set -o errexit -o nounset -o pipefail error() { echo "$1" @@ -20,3 +20,4 @@ dest_path="$PWD/$1" mkdir -p "$(dirname "$dest_path")" mv "$source_path" "$dest_path" ln -s "$dest_path" "$source_path" +echo "link $1" >> install.sh diff --git a/install.sh b/install.sh index 4525c1ab..13d0d99b 100755 --- a/install.sh +++ b/install.sh @@ -2,23 +2,35 @@ # Create symlinks in ~ for files in the current directory. -set -e +set -o errexit -o nounset -o pipefail error() { echo "$1" exit 1 } -paths=$(find $PWD -type f -not \( -path '*/.git/*' -o -path '*/Library/*' -o -name '.*.sw?' -o -name 'README.md' -o -name '*.sh' -o -name '*.plist' \)) +link() { + local source_path="$PWD/$1" + local dest_path="$HOME/$1" -for source_path in $paths; do - rel_path="${source_path#$PWD/}" - dest_path="$HOME/$rel_path" - - [ -h "$dest_path" ] && continue + [ -h "$dest_path" ] && return [ -e "$dest_path" ] && error "$dest_path exists" mkdir -p "$(dirname $dest_path)" ln -s "$source_path" "$dest_path" - echo "$rel_path" -done + echo "$1" +} + +link .config/git/config +link .config/git/ignore +link .config/nvim/autoload/pathogen.vim +link .config/nvim/colors/gruvbox.vim +link .config/nvim/init.vim +link .gnupg/gpg-agent.conf +link .psqlrc +link .ssh/config +link .tmux.conf +link .vim/autoload/pathogen.vim +link .vim/colors/gruvbox.vim +link .vimrc +link .zshrc diff --git a/prune.sh b/prune.sh index 2480b7ba..af2379e5 100755 --- a/prune.sh +++ b/prune.sh @@ -2,7 +2,7 @@ # Remove symbolic links in ~ to files that no longer exist. -set -e +set -o errexit -o nounset -o pipefail paths=$(find -L ~ -type l -lname "$PWD/*") |