lib/autoupdate: fix preventive measures

This commit is contained in:
Astro 2022-01-10 15:42:05 +01:00
parent 1a24cc1c5e
commit 5eb05b49e1
1 changed files with 2 additions and 3 deletions

View File

@ -16,7 +16,6 @@
# autoupdate-enabled. it is checked to prevent autoupdating back
# to a system without autoupdate when deploying with autoupdate
# for the first time.
environment.etc."autoupdated".text = "";
systemd.services.autoupdate = {
wantedBy = [ "multi-user.target" ];
@ -34,11 +33,11 @@
echo "New system available: $NEW"
# this should fetch the new system from the binary cache
nix build --no-link "$NEW"
if [ -e "$NEW/sw/etc/autoupdated" ]; then
if [ -e "$NEW/etc/systemd/system/autoupdate.timer" ]; then
# switch to the new system
"$NEW/bin/switch-to-configuration" switch
else
echo "New system is not yet autoupdated"
echo "New system is not yet autoupdate-enabled. Refusing to switch into a dead end."
fi
else
echo "No update required"