release/rc.local: Provide option to shutdown after installation complete

This can be useful instead of reboot if installing in a virtual machine,
and the user wants to modify the VM hardware or virtual media mounts
prior to booting into the newly installed system.

Reported by:	Juan Manuel Palacios (@jmp_imaginarium on Twitter)
Approved by:	philip
Differential Revision:	https://reviews.freebsd.org/D36560
This commit is contained in:
Ben Woods 2022-09-14 21:03:22 +08:00
parent 0e2af3b59a
commit e4505364c0

View File

@ -74,7 +74,19 @@ $BSDDIALOG_OK) # Install
trap true SIGINT # Ignore cntrl-C here
bsdinstall
if [ $? -eq 0 ]; then
bsddialog --backtitle "FreeBSD Installer" --title "Complete" --yes-label "Reboot" --no-label "Live CD" --yesno "Installation of FreeBSD complete! Would you like to reboot into the installed system now?" 0 0 && reboot
bsddialog --backtitle "FreeBSD Installer" --title "Complete" --ok-label "Reboot" --extra-button --extra-label "Shutdown" --cancel-label "Live CD" --yesno "Installation of FreeBSD complete! Would you like to reboot into the installed system now?" 0 0
case $? in
$BSDDIALOG_OK) # Reboot
reboot
;;
$BSDDIALOG_EXTRA) # Shutdown
shutdown -p now
;;
$BSDDIALOG_CANCEL) # Live CD
exit 0
;;
esac
else
. /etc/rc.local
fi