Skip to content

Commit a0fd2b7

Browse files
authored
Merge pull request #504 from jfly/actually-reboot
Actually reboot if the reboot phase is specified
2 parents 39866af + 9bd0f97 commit a0fd2b7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/nixos-anywhere.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,17 +753,24 @@ if [ ! -z ${NIXOS_NO_CHECK+0} ]; then
753753
export NIXOS_NO_CHECK
754754
fi
755755
nixos-install --no-root-passwd --no-channel-copy --system "$nixosSystem"
756-
if [ ${phases[reboot]} == 1 ]; then
756+
SSH
757+
758+
}
759+
760+
nixosReboot() {
761+
step Rebooting
762+
runSsh sh <<SSH
757763
if command -v zpool >/dev/null && [ "\$(zpool list)" != "no pools available" ]; then
758764
# we always want to export the zfs pools so people can boot from it without force import
759765
umount -Rv /mnt/
760766
swapoff -a
761767
zpool export -a || true
762768
fi
763769
nohup sh -c 'sleep 6 && reboot' >/dev/null &
764-
fi
765770
SSH
766771
772+
step Waiting for the machine to become unreachable due to reboot
773+
while runSshTimeout -- exit 0; do sleep 1; done
767774
}
768775
769776
main() {
@@ -884,8 +891,7 @@ main() {
884891
fi
885892
886893
if [[ ${phases[reboot]} == 1 ]]; then
887-
step Waiting for the machine to become unreachable due to reboot
888-
while runSshTimeout -- exit 0; do sleep 1; done
894+
nixosReboot
889895
fi
890896
891897
step "Done!"

0 commit comments

Comments
 (0)