git: 34b43f4b26e4 - main - bsdinstall: add pkgbase prompt to auto script

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 29 Apr 2025 00:35:14 UTC
The branch main has been updated by emaste:

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

commit 34b43f4b26e41a70fcb67ec5d8cf394f23b3fbf9
Author:     Isaac Freund <ifreund@freebsdfoundation.org>
AuthorDate: 2025-04-14 10:33:43 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-04-29 00:34:18 +0000

    bsdinstall: add pkgbase prompt to auto script
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D49824
---
 usr.sbin/bsdinstall/scripts/auto | 86 ++++++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 34 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index 7d041be015e7..339c9da433b2 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -153,36 +153,50 @@ trap true SIGINT	# This section is optional
 trap error SIGINT	# Catch cntrl-C here
 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
-	DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST`
-	DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')"
-
-	if [ -n "$DISTMENU" ]; then
-		exec 5>&1
-		EXTRA_DISTS=$( eval bsddialog \
-		    --backtitle \"$OSNAME Installer\" \
-		    --title \"Distribution Select\" --nocancel --separate-output \
-		    --checklist \"Choose optional system components to install:\" \
-		    0 0 0 $DISTMENU \
-		2>&1 1>&5 )
-		for dist in $EXTRA_DISTS; do
-			export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
-		done
-	fi
+bsddialog --backtitle "$OSNAME Installer" --title "Select Installation Type" \
+	--yes-label "Traditional" --no-label "Packages (Experimental)" --yesno \
+	"Would you like to install the base system using traditional distribution sets or packages (experimental)?" 0 0
+if [ $? -eq 1 ]; then
+	PKGBASE=yes
 fi
 
-FETCH_DISTRIBUTIONS=""
-for dist in $DISTRIBUTIONS; do
-	if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
-		FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
-	fi
-done
-
-if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then
-	bsddialog --backtitle "$OSNAME Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0
+if [ "$PKGBASE" == yes ]; then
+	bsddialog --backtitle "$OSNAME Installer" --title "Network Installation" \
+	    --msgbox "Installation of base system packages currently requires internet access. The next few screens will allow you to configure networking." 0 0
 	bsdinstall netconfig || error
 	NETCONFIG_DONE=yes
+else
+	export DISTRIBUTIONS="${DISTRIBUTIONS:-base.txz kernel.txz}"
+	if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
+		DISTMENU=`awk -F'\t' '!/^(kernel\.txz|base\.txz)/{print $1,$5,$6}' $BSDINSTALL_DISTDIR/MANIFEST`
+		DISTMENU="$(echo ${DISTMENU} | sed -E 's/\.txz//g')"
+
+		if [ -n "$DISTMENU" ]; then
+			exec 5>&1
+			EXTRA_DISTS=$( eval bsddialog \
+			    --backtitle \"$OSNAME Installer\" \
+			    --title \"Distribution Select\" --nocancel --separate-output \
+			    --checklist \"Choose optional system components to install:\" \
+			    0 0 0 $DISTMENU \
+			2>&1 1>&5 )
+			for dist in $EXTRA_DISTS; do
+				export DISTRIBUTIONS="$DISTRIBUTIONS $dist.txz"
+			done
+		fi
+	fi
+
+	FETCH_DISTRIBUTIONS=""
+	for dist in $DISTRIBUTIONS; do
+		if [ ! -f $BSDINSTALL_DISTDIR/$dist ]; then
+			FETCH_DISTRIBUTIONS="$FETCH_DISTRIBUTIONS $dist"
+		fi
+	done
+
+	if [ -n "$FETCH_DISTRIBUTIONS" -a -n "$BSDINSTALL_CONFIGCURRENT" ]; then
+		bsddialog --backtitle "$OSNAME Installer" --title "Network Installation" --msgbox "Some installation files were not found on the boot volume. The next few screens will allow you to configure networking so that they can be downloaded from the Internet." 0 0
+		bsdinstall netconfig || error
+		NETCONFIG_DONE=yes
+	fi
 fi
 
 rm -f $PATH_FSTAB
@@ -339,16 +353,20 @@ esac
 
 [ -f /usr/libexec/bsdinstall/local.pre-fetch ] && f_dprintf "Running local.pre-fetch" && sh /usr/libexec/bsdinstall/local.pre-fetch "$BSDINSTALL_CHROOT"
 
-if [ -n "$FETCH_DISTRIBUTIONS" ]; then
-	exec 5>&1
-	export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&5)
-	FETCH_RESULT=$?
-	exec 5>&-
+if [ "$PKGBASE" == yes ]; then
+	bsdinstall pkgbase || error "Installation of base system packages failed"
+else
+	if [ -n "$FETCH_DISTRIBUTIONS" ]; then
+		exec 5>&1
+		export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&5)
+		FETCH_RESULT=$?
+		exec 5>&-
 
-	[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
+		[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
+	fi
+	bsdinstall checksum || error "Distribution checksum failed"
+	bsdinstall distextract || error "Distribution extract failed"
 fi
-bsdinstall checksum || error "Distribution checksum failed"
-bsdinstall distextract || error "Distribution extract failed"
 
 # Set up boot loader
 bsdinstall bootconfig || error "Failed to configure bootloader"