Linking directories

This commit is contained in:
Christian Colglazier 2019-12-23 10:50:44 -05:00
parent 46b4a3f945
commit 3d6fac2664

View File

@ -4,11 +4,12 @@ dotdir=~/dotfiles
# src dest sudo # src dest sudo
files=($dotdir/.zshrc ~/ 'n' \ files=($dotdir/.zshrc ~/ 'n' \
${dotdir}/alacritty/alacritty.yml ~/.config/alacritty/ 'n') ${dotdir}/alacritty/alacritty.yml ~/.config/alacritty/ 'n'
${dotdir}/g13 ~/.config/ 'n')
echo Setting up dotfiles... echo Setting up dotfiles...
# # Loop through config files
for (( i=0; i<${#files[@]} ; i+=3 )) ; do for (( i=0; i<${#files[@]} ; i+=3 )) ; do
# Check if sudo is needed # Check if sudo is needed
pre='' pre=''
@ -19,11 +20,12 @@ for (( i=0; i<${#files[@]} ; i+=3 )) ; do
destPath=${files[i+1]}$(basename "${files[i]}") destPath=${files[i+1]}$(basename "${files[i]}")
# Check if file already exists # Check if file already exists
if [ -f $destPath ]; then if [ -e $destPath ]; then
# Check if path is not a sybolic link # Check if path is not a sybolic link
if ! [ -L $destPath ]; then if ! [ -L $destPath ]; then
echo Backing up $destPath echo Backing up $destPath
$pre mv $destPath ${destPath}.bak $pre mv $destPath ${destPath}.bak
# File already set up
else else
echo The file $destPath is already set up echo The file $destPath is already set up
continue continue