punktdateien/bin/updater

29 lines
913 B
Text
Raw Normal View History

2023-12-13 20:03:46 +01:00
#!/bin/bash
export "UPDATER_VERSION=1"
if [ "$STAGE" == "1" ]; then
echo ":: Removing files (again)"
./uninstall.sh
echo ":: Installing files"
./install.sh
rm -rf "$HOME/.config/.jstm_dotfiles_updater"
2024-05-19 21:06:50 +02:00
echo ":: Update complete."
echo " Please execute \"dotfiles-install-software\" to"
2024-05-19 21:07:29 +02:00
echo " install and update required software."
2023-12-13 20:03:46 +01:00
else
echo ":: Checking for updates"
2023-12-16 23:55:05 +01:00
if [ ! "$1" == "--force" ] && [ "$(env SCRIPTED=true dotfiles-updatechecker)" == "" ]; then
2023-12-13 20:03:46 +01:00
echo ":: No update is available. Use \"--force\" to update anyway."
exit 1
fi
# Unused as of now, may be used in a later commit
echo ":: Writing info file"
echo "UPDATER_VERSION_OLD=${UPDATER_VERSION}" > "$HOME/.config/.jstm_dotfiles_updater"
echo ":: Removing files"
cd "$HOME/.dotfiles"
./uninstall.sh
echo ":: Pulling updates"
git pull
echo ":: Running updater (stage 2)"
2024-05-19 21:06:50 +02:00
exec env STAGE=1 "$HOME/.dotfiles/bin/updater"
2023-12-13 20:03:46 +01:00
fi