syspunktdateien/bin/updater

27 lines
793 B
Text
Raw Normal View History

2024-03-15 01:32:32 +01:00
#!/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 "/etc/.jstm_sysdotfiles_updater"
else
echo ":: Checking for updates"
if [ ! "$1" == "--force" ] && [ "$(env SCRIPTED=true sysdotfiles-updatechecker)" == "" ]; 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}" > "/etc/.jstm_sysdotfiles_updater"
echo ":: Removing files"
cd "/etc/sysdotfiles"
./uninstall.sh
echo ":: Pulling updates"
git pull
echo ":: Running updater (stage 2)"
env STAGE=1 "/etc/sysdotfiles/bin/updater"
fi