perform reboot in the background

This allows the user to monitor reboot happens from a script and run
further actions after it comes back.
This commit is contained in:
Jörg Thalheim 2023-01-12 11:53:19 +01:00
parent 61a3eaa8db
commit 2179012ece

View File

@ -36,7 +36,7 @@ abort() {
kexec_url=https://github.com/nix-community/nixos-images/releases/download/nixos-22.11/nixos-kexec-installer-x86_64-linux.tar.gz
enable_debug=""
maybereboot="reboot"
maybereboot="sleep 6 && reboot"
declare -A disk_encryption_keys
@ -252,5 +252,7 @@ set -efu ${enable_debug}
# needed for installation if initrd-secrets are used
mkdir -m777 -p /mnt/tmp
nixos-install --no-root-passwd --no-channel-copy --system "$nixos_system"
${maybereboot}
# We will reboot in background so we can cleanly finish the script before the hosts go down.
# This makes integration into scripts easier
nohup bash -c '${maybereboot}' >/dev/null &
SSH