57 lines
1.4 KiB
Bash
Executable file
57 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
cd "${HOME}/.dotfiles" || (
|
|
echo ":: Error: Can't cd into ${HOME}/.dotfiles"
|
|
exit 1
|
|
)
|
|
|
|
# Define updater version
|
|
LOCAL_UPDATER_VERSION=4
|
|
|
|
case "${STAGE}" in
|
|
1)
|
|
# 0 - 2 -> 3
|
|
if [ -z "${UPDATER_VERSION}" ] || [ "${UPDATER_VERSION}" -lt "3" ]; then
|
|
echo ":: S1 | Updating to UPDATER_VERSION 3"
|
|
./uninstall.sh --remove-legacy-paths
|
|
fi
|
|
|
|
# 3 -> 4
|
|
if [ "${UPDATER_VERSION}" -lt "4" ]; then
|
|
echo ":: S1 | Updating to UPDATER_VERSION 4"
|
|
./uninstall.sh --remove-unshared-bashrcd
|
|
fi
|
|
|
|
|
|
echo ":: S1 | Uninstalling"
|
|
./uninstall.sh
|
|
|
|
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
|