Working on install script

This commit is contained in:
Kris Lamoureux 2020-01-09 23:45:39 -05:00
parent b48d037c55
commit 8a5bb606b9
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

28
install.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
DOTFILES="$(pwd)/.*[a-z]"
DATE=$(date '+%Y%m%d%H%M%S')
for FILE in $DOTFILES ; do
BASEFILE=$(basename $FILE)
# Exclude the repo's .git folder
if [ "$BASEFILE" != ".git" ] ; then
# If dotfile is not a symlink and exists then back it up
if [ ! -L ~/$BASEFILE ] ; then
read -p "Press [ENTER] to move ~/$BASEFILE to ~/$BASEFILE-$DATE"
echo "mv ~/$BASEFILE ~/$BASEFILE-$DATE"
fi
# If dotfile doesn't exist then link it.
if [ ! -e "~/$BASEFILE" ] ; then
echo "ln -s $FILE ~/$BASEFILE"
else
echo "~/$BASEFILE is already a symlink. Nothing to do."
fi
fi
done