summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2016-04-06 20:53:14 -0400
committerJune McEnroe <programble@gmail.com>2016-04-06 20:53:14 -0400
commit566564eb9cd1162f3e270997e6381700253c4341 (patch)
tree1bdf482346b714c579a2a13e7f33319a1fca9e55
parentAdd gpg-agent to README (diff)
downloadsrc-566564eb9cd1162f3e270997e6381700253c4341.tar.gz
src-566564eb9cd1162f3e270997e6381700253c4341.zip
Simplify install script
-rwxr-xr-ximport.sh3
-rwxr-xr-xinstall.sh30
-rwxr-xr-xprune.sh2
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/*")