punktdateien/bin/updater

48 lines
1.1 KiB
Text
Raw Normal View History

2023-12-13 20:03:46 +01:00
#!/bin/bash
2024-06-02 17:15:38 +02:00
cd "${HOME}/.dotfiles" || (
echo ":: Error: Can't cd into ${HOME}/.dotfiles"
exit 1
)
# Define updater version
UPDATER_VERSION=3
2024-06-02 17:15:38 +02:00
case "${STAGE}" in
1)
2024-06-02 21:22:21 +02:00
echo ":: S1 | Unlinking files"
2024-06-02 17:15:38 +02:00
./uninstall.sh
2024-06-02 21:24:54 +02:00
[[ -z "${UPDATER_VERSION}" ]] || [[ "${UPDATER_VERSION}" -lt "3" ]] &&
./uninstall.sh --remove-legacy-paths
2024-06-02 21:22:21 +02:00
echo ":: S1 | Linking files"
2024-06-02 17:15:38 +02:00
./install.sh
# Remove legacy updater version file
rm -rf "$HOME/.config/.jstm_dotfiles_updater"
2024-06-02 21:22:21 +02:00
echo ":: S1 | Update complete."
2024-06-02 17:15:38 +02:00
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 | Unlinking files"
./uninstall.sh
echo ":: S0 | Pulling updates"
git pull
exec env STAGE=1 UPDATER_VERSION=${UPDATER_VERSION} "$HOME/.dotfiles/bin/updater"
;;
esac