git: 17f4ded55180 - main - bsdinstall: add variables to allow skipping over some phases of the install

From: Brad Davis <brd_at_FreeBSD.org>
Date: Tue, 16 Aug 2022 21:15:17 UTC
The branch main has been updated by brd:

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

commit 17f4ded55180e1023b9023493c3f215c3a47a445
Author:     Brad Davis <brd@FreeBSD.org>
AuthorDate: 2022-08-16 21:11:44 +0000
Commit:     Brad Davis <brd@FreeBSD.org>
CommitDate: 2022-08-16 21:11:44 +0000

    bsdinstall: add variables to allow skipping over some phases of the install
    
    Reviewed by:    allanjude, dteske
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D35357
---
 usr.sbin/bsdinstall/scripts/auto | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index 7d5396d15c01..553c51b82287 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -147,10 +147,10 @@ rm -rf $BSDINSTALL_TMPETC
 mkdir $BSDINSTALL_TMPETC
 
 trap true SIGINT	# This section is optional
-bsdinstall keymap
+[ -z "$BSDINSTALL_SKIP_KEYMAP" ] && bsdinstall keymap
 
 trap error SIGINT	# Catch cntrl-C here
-bsdinstall hostname || error "Set hostname failed"
+if [ -z "$BSDINSTALL_SKIP_HOSTNAME" ]; then bsdinstall hostname || error "Set hostname failed"; fi
 
 export DISTRIBUTIONS="${DISTRIBUTIONS:-base.txz kernel.txz}"
 if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
@@ -354,11 +354,12 @@ trap true SIGINT	# This section is optional
 if [ "$NETCONFIG_DONE" != yes ]; then
 	bsdinstall netconfig	# Don't check for errors -- the user may cancel
 fi
-bsdinstall time
-bsdinstall services
-bsdinstall hardening
+[ -z "$BSDINSTALL_SKIP_TIME" ] && bsdinstall time
+[ -z "$BSDINSTALL_SKIP_SERVICES" ] && bsdinstall services
+[ -z "$BSDINSTALL_SKIP_HARDENING" ] && bsdinstall hardening
 
-dialog --backtitle "$OSNAME Installer" --title "Add User Accounts" --yesno \
+[ -z "$BSDINSTALL_SKIP_USERS" ] && dialog --backtitle "$OSNAME Installer" \
+	--title "Add User Accounts" --yesno \
     "Would you like to add users to the installed system now?" 0 0 && \
     bsdinstall adduser
 
@@ -415,7 +416,7 @@ finalconfig() {
 }
 
 # Allow user to change his mind
-finalconfig
+[ -z "$BSDINSTALL_SKIP_FINALCONFIG" ] && finalconfig
 
 trap error SIGINT	# SIGINT is bad again
 bsdinstall config  || error "Failed to save config"
@@ -424,14 +425,16 @@ if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then
 	rm -rf "$BSDINSTALL_FETCHDEST"
 fi
 
-dialog --backtitle "$OSNAME Installer" --title "Manual Configuration" \
-    --default-button no --yesno \
-   "The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0
-if [ $? -eq 0 ]; then
-	clear
-	echo This shell is operating in a chroot in the new system. \
-	    When finished making configuration changes, type \"exit\".
-	chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1
+if [ -z "$BSDINSTALL_SKIP_MANUAL" ]; then
+	dialog --backtitle "$OSNAME Installer" --title "Manual Configuration" \
+		--default-button no --yesno \
+		"The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0
+	if [ $? -eq 0 ]; then
+		clear
+		echo This shell is operating in a chroot in the new system. \
+		    When finished making configuration changes, type \"exit\".
+		chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1
+	fi
 fi
 
 bsdinstall entropy