blob: 5e56e51402d0214d7aa42c5fae3917d78c7ccb57 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env bash
pc_settings_path="${HOME}/pc_settings"
config_files=( \
".zsh_profile" \
".tmux.conf" \
".ctags" \
".vimrc" \
".emacs" \
)
for i in {1..5}; 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
# Fish Shell is a special case
cf_dir="${HOME}/.configs/fish"
cf="config.fish"
if [ -f "${cf_dir}/${cf}" ] && [ ! -L "${cf_dir}/${cf}" ]; then
echo -n "Backing up ${cf} ... " && \
mv "${cf_dir}/${cf}" "${HOME}/${cf}.bak" && \
echo "Done."
fi
if [ -L "${cf_dir}/${cf}" ]; then
if [ $(readlink "${cf_dir}/${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}" "${cf_dir}/${cf}" && \
echo "Done."
fi
echo ""
|