2016-10-15 19:31:55 +02:00
|
|
|
#!/usr/bin/env bash
|
2016-05-07 21:40:49 +02:00
|
|
|
|
|
|
|
# list of files/folders to symlink in homedir
|
2017-06-17 01:44:58 +02:00
|
|
|
FILES=".bash_aliases .bash_prompt .bashrc .profile bin .vimrc .npmrc"
|
2016-05-07 21:40:49 +02:00
|
|
|
|
|
|
|
for FILE in $FILES; do
|
2016-05-07 22:22:39 +02:00
|
|
|
|
|
|
|
# remove old versions
|
2016-05-07 22:51:14 +02:00
|
|
|
if [ -f "$HOME/$FILE" ]; then
|
2017-07-29 20:27:19 +02:00
|
|
|
rm "$HOME"/"$FILE"
|
2016-05-07 22:51:14 +02:00
|
|
|
elif [ -d "$HOME/$FILE" ]; then
|
2017-07-29 20:27:19 +02:00
|
|
|
rm -r "${HOME:?}"/"$FILE"
|
2016-05-07 22:22:39 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# symlink files
|
2017-07-29 20:27:19 +02:00
|
|
|
ln -s "$PWD"/"$FILE" "$HOME"/"$FILE"
|
2016-05-07 21:40:49 +02:00
|
|
|
echo "$(tput setaf 64)✓$(tput sgr0) Symlink created to $(tput setaf 37)$FILE$(tput sgr0)"
|
2016-05-07 22:22:39 +02:00
|
|
|
|
2016-05-07 21:40:49 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
# source what we just created
|
2017-07-29 20:27:19 +02:00
|
|
|
source "$HOME"/.profile
|