about summary refs log blame commit diff
path: root/configs/setup_configs.sh
blob: 02d863277f2b60a8c8e5a3cb881b6217bc339f00 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12


                   


                                    





                  

 
                   
                           
                    
 







                                                                              
                                                                               
            
                                                                                





                                                                       
           
    
 
#!/usr/bin/env bash


pc_settings_path="$HOME/pc_settings"


config_files=( \
  ".zsh_profile" \
  ".tmux.conf" \
  ".ctags" \
  ".vimrc" \
)


for i in {0..3}; do
    cf="${config_files[i]}"
    echo "\"$cf\": "

    if [ -f "$HOME/$cf" ] && [ ! -L "$HOME/$cf" ]; then
        echo -n "Backing up $cf ... " && \
        mv "$HOME/$cf" "$HOME/$cf.bak" && \
        echo "Done."
    fi

    if [ -L "$HOME/$cf" ]; then
        if [ $(readlink "$HOME/$cf") = "$pc_settings_path/configs/$cf" ]; then
            echo "Already properly symlinked to \"$pc_settings_path/configs\"."
        else
            echo "Already symlinked but NOT to the proper location. Aborting..."
        fi
    else
        echo -n "Symlinking to $pc_settings_path/configs/$cf ... " && \
        ln -s "$pc_settings_path/configs/$cf" "$HOME/$cf" && \
        echo "Done."
    fi
    echo ""
done