Use stow in make.sh

panther
J. Fernando Sánchez 7 years ago
parent fc49bdf6c4
commit 37837558b1

@ -1,4 +1,4 @@
FROM ubuntu:14.04
FROM ubuntu:16.04
RUN apt-get update -y
RUN apt-get install -y build-essential

@ -14,20 +14,11 @@ git submodule init
git submodule update --recursive
olddir=~/dotfiles$(date +%Y-%m-%d_%H:%M:%S) # old dotfiles backup directory
files=$(ls --ignore="not_dots" --ignore="README.md" --ignore="make.sh" --ignore="Docker" $PWD) # list of files/folders to symlink in homedir
files=$(ls -1 --ignore="not_dots" --ignore="README.md" --ignore="make.sh" --ignore="Docker" $PWD) # list of files/folders to symlink in homedir
##########
# create dotfiles_old in homedir
echo "** Creating $olddir for backup: of any existing dotfiles in ~"
mkdir -p $olddir
echo "...done"
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
echo "** Creating symlinks. Any existing dotfiles will be moved to: $olddir"
for file in $files; do
mv ~/.$file $olddir && echo "Backed up: ~/.$file"
ln -s $PWD/$file ~/.$file
stow -v $file
done
rmdir $olddir 2>/dev/null && echo "Backup dir empty. Removed"

Loading…
Cancel
Save