git: e4505364c087 - main - release/rc.local: Provide option to shutdown after installation complete

From: Ben Woods <woodsb02_at_FreeBSD.org>
Date: Sat, 17 Sep 2022 00:08:21 UTC
The branch main has been updated by woodsb02 (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=e4505364c08764e7d7d70b1a0ce7de7fb041de62

commit e4505364c08764e7d7d70b1a0ce7de7fb041de62
Author:     Ben Woods <woodsb02@FreeBSD.org>
AuthorDate: 2022-09-14 13:03:22 +0000
Commit:     Ben Woods <woodsb02@FreeBSD.org>
CommitDate: 2022-09-17 00:07:25 +0000

    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
---
 release/rc.local | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/release/rc.local b/release/rc.local
index 0b8df48b2085..94f8927989f5 100755
--- a/release/rc.local
+++ b/release/rc.local
@@ -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