2016-08-19 18:02:49 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
2016-12-31 03:10:34 +01:00
|
|
|
pc_settings_path="${HOME}/pc_settings"
|
2016-11-10 17:47:44 +01:00
|
|
|
|
|
|
|
|
2016-11-10 18:12:45 +01:00
|
|
|
config_files=( \
|
|
|
|
".zsh_profile" \
|
|
|
|
".tmux.conf" \
|
|
|
|
".ctags" \
|
|
|
|
".vimrc" \
|
2016-12-31 03:10:34 +01:00
|
|
|
".emacs" \
|
2016-11-10 18:12:45 +01:00
|
|
|
)
|
2016-11-10 17:47:44 +01:00
|
|
|
|
|
|
|
|
2016-12-31 03:10:34 +01:00
|
|
|
for i in {1..5}; do
|
2016-11-10 17:47:44 +01:00
|
|
|
cf="${config_files[i]}"
|
2016-12-31 03:10:34 +01:00
|
|
|
echo "\"${cf}\": "
|
2016-11-10 20:49:13 +01:00
|
|
|
|
2016-12-31 03:10:34 +01:00
|
|
|
if [ -f "${HOME}/${cf}" ] && [ ! -L "${HOME}/${cf}" ]; then
|
|
|
|
echo -n "Backing up ${cf} ... " && \
|
|
|
|
mv "${HOME}/${cf}" "${HOME}/${cf}.bak" && \
|
2016-11-10 17:47:44 +01:00
|
|
|
echo "Done."
|
|
|
|
fi
|
|
|
|
|
2016-12-31 03:10:34 +01:00
|
|
|
if [ -L "${HOME}/${cf}" ]; then
|
|
|
|
if [ $(readlink "${HOME}/${cf}") = "${pc_settings_path}/configs/${cf}" ]; then
|
|
|
|
echo "Already properly symlinked to \"${pc_settings_path}/configs\"."
|
2016-11-10 17:47:44 +01:00
|
|
|
else
|
2016-11-10 18:12:45 +01:00
|
|
|
echo "Already symlinked but NOT to the proper location. Aborting..."
|
2016-11-10 17:47:44 +01:00
|
|
|
fi
|
|
|
|
else
|
2016-12-31 03:10:34 +01:00
|
|
|
echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \
|
|
|
|
ln -s "${pc_settings_path}/configs/${cf}" "${HOME}/${cf}" && \
|
2016-11-10 17:47:44 +01:00
|
|
|
echo "Done."
|
|
|
|
fi
|
2016-11-10 18:12:45 +01:00
|
|
|
echo ""
|
2016-11-10 17:47:44 +01:00
|
|
|
done
|
2017-01-17 23:51:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Fish Shell is a special case
|
2017-05-17 03:24:29 +02:00
|
|
|
# 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 ""
|