Auto-upgrade: Abort on failure

This commit is contained in:
fruchti 2023-11-27 10:59:54 +01:00
parent 8a29fc400b
commit c14bc08deb

View file

@ -118,8 +118,7 @@ in
send_email=yes send_email=yes
email_subject="Upgrade failed (exit code $exit_code)" email_subject="Upgrade failed (exit code $exit_code)"
email_body="The system upgrade started at $start_time has failed with exit code $exit_code." email_body="The system upgrade started at $start_time has failed with exit code $exit_code."
fi else
echo " Determining package differences." | tee -a "$output_file" echo " Determining package differences." | tee -a "$output_file"
installed_packages() installed_packages()
{ {
@ -174,6 +173,7 @@ in
${nixos-rebuild} switch ${toString cfg.flags} 2>&1 | tee -a "$output_file" || exit_code=$? ${nixos-rebuild} switch ${toString cfg.flags} 2>&1 | tee -a "$output_file" || exit_code=$?
fi fi
''} ''}
fi
upgrade_output="$(cat "$output_file")" upgrade_output="$(cat "$output_file")"
rm -f "$output_file" rm -f "$output_file"