modules/clerie-system-upgrade: Always reboot after an update
This commit is contained in:
@ -238,7 +238,6 @@
|
||||
};
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,6 @@
|
||||
};
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
startAt = "*-*-* 06:22:00";
|
||||
};
|
||||
|
@ -106,7 +106,6 @@
|
||||
};
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
startAt = "*-*-* 07:22:00";
|
||||
};
|
||||
|
@ -162,7 +162,6 @@
|
||||
'';
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
};
|
||||
|
||||
|
@ -71,7 +71,6 @@
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
networking.firewall.allowedUDPPorts = [];
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
};
|
||||
|
||||
clerie.system-auto-upgrade = {
|
||||
allowReboot = true;
|
||||
autoUpgrade = true;
|
||||
};
|
||||
|
||||
|
@ -10,11 +10,6 @@ in
|
||||
options = {
|
||||
clerie.system-auto-upgrade = {
|
||||
enable = mkEnableOption "clerie system upgrade";
|
||||
allowReboot = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Monitor NixOS";
|
||||
};
|
||||
autoUpgrade = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@ -38,7 +33,7 @@ in
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.clerie-system-upgrade + "/bin/clerie-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}${optionalString (config.clerie.monitoring.enable) " --node-exporter-metrics-path /var/lib/prometheus-node-exporter/textfiles/clerie-system-upgrade.prom"}";
|
||||
ExecStart = pkgs.clerie-system-upgrade + "/bin/clerie-system-upgrade --no-confirm${optionalString (config.clerie.monitoring.enable) " --node-exporter-metrics-path /var/lib/prometheus-node-exporter/textfiles/clerie-system-upgrade.prom"}";
|
||||
};
|
||||
};
|
||||
systemd.timers.clerie-system-auto-upgrade = mkIf cfg.autoUpgrade {
|
||||
|
@ -2,16 +2,11 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ALLOW_REBOOT=
|
||||
NO_CONFIRM=
|
||||
NODE_EXPORTER_METRICS_PATH=
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--allow-reboot)
|
||||
ALLOW_REBOOT=1
|
||||
shift
|
||||
;;
|
||||
--no-confirm)
|
||||
NO_CONFIRM=1
|
||||
shift
|
||||
@ -63,13 +58,8 @@ ACTIVATING_SYSTEM_KERNEL="$(readlink /nix/var/nix/profiles/system/{initrd,kernel
|
||||
|
||||
if [[ "$BOOTED_SYSTEM_KERNEL" != "$ACTIVATING_SYSTEM_KERNEL" ]]; then
|
||||
echo "Reboot is required"
|
||||
if [[ -n "$ALLOW_REBOOT" ]]; then
|
||||
echo "Rebooting system now"
|
||||
shutdown -r +1 "System update requires reboot"
|
||||
else
|
||||
echo "Automatic reboot not allowed (maybe use --allow-reboot next time)"
|
||||
echo "The system upgrade is staged, please reboot manually soon"
|
||||
fi
|
||||
echo "Rebooting system now"
|
||||
shutdown -r +1 "System update requires reboot"
|
||||
else
|
||||
echo "No reboot is required"
|
||||
echo "Activating system now"
|
||||
|
Reference in New Issue
Block a user