diff options
author | Tharre <tharre3@gmail.com> | 2017-07-27 18:47:02 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2017-07-27 19:07:16 +0200 |
commit | 5b03419f8f2ae75b5708ed7b441f4535e3d10062 (patch) | |
tree | 2b1c138b16972d0c651e1d520ad8cc25634bbc63 /install.sh | |
parent | b66eae6ef3680795471a0bc72dd99f66e87cb319 (diff) | |
download | dotfiles-5b03419f8f2ae75b5708ed7b441f4535e3d10062.tar.gz dotfiles-5b03419f8f2ae75b5708ed7b441f4535e3d10062.tar.xz dotfiles-5b03419f8f2ae75b5708ed7b441f4535e3d10062.zip |
Rewrite install.sh to not rely on interpreter
Diffstat (limited to 'install.sh')
-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 |