52 lines
1.3 KiB
Bash
Executable file
52 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
cd "${HOME}/.dotfiles" || (
|
|
echo ":: Error: Can't cd into ${HOME}/.dotfiles"
|
|
exit 1
|
|
)
|
|
|
|
# Define updater version
|
|
LOCAL_UPDATER_VERSION=3
|
|
|
|
case "${STAGE}" in
|
|
1)
|
|
if [ -z "${UPDATER_VERSION}" ] || [ "${UPDATER_VERSION}" -lt "3" ]; then
|
|
echo ":: S1 | Unlinking legacy file paths"
|
|
./uninstall.sh --remove-legacy-paths
|
|
|
|
echo ":: S1 | Uninstalling & unlinking (safety measure)"
|
|
./uninstall.sh
|
|
else
|
|
echo ":: S1 | Uninstalling"
|
|
./uninstall.sh
|
|
fi
|
|
|
|
echo ":: S1 | Installing"
|
|
./install.sh
|
|
|
|
# Remove legacy updater version file
|
|
[[ -f "${HOME}/.config/.jstm_dotfiles_updater" ]] && rm -rf "${HOME}/.config/.jstm_dotfiles_updater"
|
|
|
|
echo ":: S1 | Update complete."
|
|
echo " Make sure to execute \"dotfiles-install-software\""
|
|
echo " to install/update required software."
|
|
echo " Append \"--gui\" to install required GUI stuff."
|
|
|
|
;;
|
|
*)
|
|
echo ":: Checking for updates"
|
|
|
|
if [ ! "${1}" == "--force" ] && [ "$(env SCRIPTED=true dotfiles-updatechecker)" == "" ]; then
|
|
echo ":: No update is available. Use \"--force\" to update anyway."
|
|
exit 1
|
|
fi
|
|
|
|
echo ":: S0 | Uninstalling"
|
|
./uninstall.sh
|
|
|
|
echo ":: S0 | Pulling updates"
|
|
git pull
|
|
|
|
exec env STAGE=1 UPDATER_VERSION=${LOCAL_UPDATER_VERSION} "${HOME}/.dotfiles/bin/updater"
|
|
|
|
;;
|
|
esac
|