diff options
1 files changed, 13 insertions, 3 deletions
| -rwxr-xr-x | install.sh | 16 |
@@ -1,11 +1,20 @@ #!/usr/bin/env bash +copy="" +while [ -n "$1" ] +do + case "$1" in + (cp | copy) copy="yes" ;; + esac + shift +done + while read -r conf do [ -z "$conf" ] && continue [ ! -f "$conf" ] && echo "warning: $conf is not a regular file, skipping!" && continue - dest="$HOME/$conf" + dest="$HOME/${conf##\./}" if [ -f "$dest" ] && ! cmp --silent -- "$dest" "$conf" then diff "$dest" "$conf" @@ -17,8 +26,9 @@ do dir="$(dirname "$dest")" [ ! -d "$dir" ] && mkdir -p "$dir" || rm "$dest" >/dev/null 2>&1 - ln -s "$PWD/$conf" "$dest" + + [ -n "$copy" ] && cp "$PWD/$conf" "$dest" || ln -s "$PWD/$conf" "$dest" echo "Installed ${conf##\./}" done <<EOF -$(find . -type f -not -path './.git/*' -not -name 'README.md' -not -name 'install.sh' -not -name 'copy.sh') +$(find . -type f -not -path './.git/*' -not -name 'README.md' -not -name 'install.sh') EOF |
