about summary refs log tree commit diff
path: root/configs/setup_configs.sh
blob: 7176259347b81a63d4b872866f43da6b93ea6bd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash


pc_settings_path="$HOME/pc_settings"


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


for i in {1..3}; do
    cf="${config_files[i]}"
    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 "\"$cf\" is already properly symlinked to \"$pc_settings_path/configs\"."
        else
            echo "\"$cf\" is symlinked but not to the proper location."
        fi
    else
        echo -n "Symlinking to $pc_settings_path/configs/$cf ... " && \
        ln -s "$pc_settings_path/configs/$cf" "$HOME/$cf" && \
        echo "Done."
    fi
done