punktdateien/bin/updater
2023-12-13 20:03:46 +01:00

26 lines
800 B
Bash
Executable file

#!/bin/bash
export "UPDATER_VERSION=1"
if [ "$STAGE" == "1" ]; then
echo ":: Removing files (again)"
./uninstall.sh
echo ":: Installing files"
./install.sh
echo ":: Update complete."
rm -rf "$HOME/.config/.jstm_dotfiles_updater"
else
echo ":: Checking for updates"
if [ "$(env SCRIPTED=true dotfiles-updatechecker)" == "" ] && [ ! "$1" == "--force" ]; then
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)"
env STAGE=1 "$HOME/.dotfiles/bin/updater"
fi