diff options
-rwxr-xr-x | install.sh | 36 |
1 files changed, 22 insertions, 14 deletions
@@ -1,18 +1,8 @@ #!/bin/sh -e -if [ "$#" -ne 1 ]; then - # make sure all submodules are there - git submodule update --init --recursive +# Note that files MUST NOT CONTAIN NEWLINES! - # ensure mail directory exists - mkdir -p ~/.mail/tharre3@gmail.com - - find . -maxdepth 1 ! -path . ! -name .git ! -name .gitmodules \ - ! -name .gitignore ! -name .updated -name '.*' -exec "$0" {} \; - - # remove broken symlinks - find -L "$HOME" -maxdepth 1 -type l -delete -else +symlink_file() { canonical=$(echo $1 | sed "s|^\./||") target="$HOME/$canonical" origin="$(pwd)/$canonical" @@ -26,8 +16,26 @@ else # everything into that directory instead find "$canonical" -maxdepth 1 -mindepth 1 ! -name .gitignore \ - -exec "$0" {} \; + -print | while IFS= read -r file + do + symlink_file "$file" + done else echo "Target file '$target' exists, but is not a symlink. Skipping." fi -fi +} + +# make sure all submodules are there +git submodule update --init --recursive + +# ensure mail directory exists +mkdir -p ~/.mail/tharre3@gmail.com + +find . -maxdepth 1 ! -path . ! -name .git ! -name .gitmodules \ + ! -name .gitignore ! -name .updated -name '.*' -print | while IFS= read -r file +do + symlink_file "$file" +done + +# remove broken symlinks +find -L "$HOME" -maxdepth 1 -type l -delete |