diff options
| author | Manuel Amago <mamago@gmail.com> | 2016-08-10 17:32:47 +0100 |
|---|---|---|
| committer | Manuel Amago <mamago@gmail.com> | 2016-08-10 17:32:47 +0100 |
| commit | 04770be267d79757426ace930b563e94210a35dc (patch) | |
| tree | ea7edbd1fc1f69cedc78920a0363166a8b14c3e9 /install.sh | |
| parent | abc2509e9205306305a9d098abaaaaf351274de0 (diff) | |
| download | dotfiles-04770be267d79757426ace930b563e94210a35dc.tar.gz dotfiles-04770be267d79757426ace930b563e94210a35dc.zip | |
Add install script
Creates home directory dot file symlinks to the repository files.
Diffstat (limited to 'install.sh')
| -rwxr-xr-x | install.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..7d1d2fe --- /dev/null +++ b/install.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Adapted from https://github.com/torvald/dotfiles + +# Create symlinks for all dotfiles +# Use -f to overwrite existing dotfiles + +DOTFILES=$(ls -1 -d $PWD/dot-*) + +LN_OPTS="-s" +if [[ "$1" == "-f" ]]; then + LN_OPTS="$LN_OPTS -f" +fi + +for DOTFILE in $DOTFILES; do + BASENAME=$(basename $DOTFILE) + TARGET="$HOME/${BASENAME/dot-/.}" + echo ln $LN_OPTS $DOTFILE $TARGET + ln $LN_OPTS $DOTFILE $TARGET +done + +exit $? |
