punktdateien/bin/updater

49 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
2024-06-02 21:30:34 +02:00
LOCAL_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"
if [ -z "${UPDATER_VERSION}" ] || [ "${UPDATER_VERSION}" -lt "3" ]; then
./uninstall.sh --remove-legacy-paths
else
./uninstall.sh
fi
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
2024-06-02 21:30:34 +02:00
exec env STAGE=1 UPDATER_VERSION=${LOCAL_UPDATER_VERSION} "$HOME/.dotfiles/bin/updater"
2024-06-02 17:15:38 +02:00
;;
esac