git: 4daf244aedfc - main - bsdinstall: add pkgbase prompt to jail script

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

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

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

    bsdinstall: add pkgbase prompt to jail script
    
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D49823
---
 usr.sbin/bsdinstall/scripts/jail | 118 ++++++++++++++++++++++-----------------
 1 file changed, 68 insertions(+), 50 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail
index 9acea20a34d8..641c9f8a22bc 100755
--- a/usr.sbin/bsdinstall/scripts/jail
+++ b/usr.sbin/bsdinstall/scripts/jail
@@ -53,6 +53,64 @@ error() {
 	fi
 }
 
+distbase() {
+	test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
+
+	if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
+		exec 5>&1
+		BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
+		MIRROR_BUTTON=$?
+		exec 5>&-
+		test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
+		export BSDINSTALL_DISTSITE
+		fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
+	fi
+
+	: ${DISTRIBUTIONS="base.txz"}; export DISTRIBUTIONS
+	if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
+		DISTMENU=`cut -f 4,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base`
+
+		if [ ! "$nonInteractive" == "YES" ]
+		then
+			exec 5>&1
+			EXTRA_DISTS=$(echo $DISTMENU | xargs -o bsddialog \
+			    --backtitle "$OSNAME Installer" \
+			    --title "Distribution Select" --no-cancel \
+			    --separate-output \
+			    --checklist "Choose optional system components to install:" \
+			    0 0 0 \
+			    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
+	FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS`	# Trim white space
+
+	if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
+		exec 5>&1
+		BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
+		MIRROR_BUTTON=$?
+		exec 5>&-
+		test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
+		export BSDINSTALL_DISTSITE
+	fi
+
+	if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
+		bsdinstall distfetch || error "Failed to fetch distribution"
+	fi
+
+	bsdinstall checksum || error "Distribution checksum failed"
+	bsdinstall distextract || error "Distribution extract failed"
+}
+
 if [ -z "$1" ]; then
 	error "Directory can not be empty\n\nUsage:\nbsdinstall jail directory"
 fi
@@ -73,61 +131,21 @@ if [ -n "$SCRIPT" ]; then
 	. $TMPDIR/bsdinstall-installscript-preamble
 fi
 
-test ! -d $BSDINSTALL_DISTDIR && mkdir -p $BSDINSTALL_DISTDIR
-
-if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST -a -z "$BSDINSTALL_DISTSITE" ]; then
-	exec 5>&1
-	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
-	MIRROR_BUTTON=$?
-	exec 5>&-
-	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
-	export BSDINSTALL_DISTSITE
-	fetch -o $BSDINSTALL_DISTDIR/MANIFEST $BSDINSTALL_DISTSITE/MANIFEST || error "Could not download $BSDINSTALL_DISTSITE/MANIFEST"
-fi
-
-: ${DISTRIBUTIONS="base.txz"}; export DISTRIBUTIONS
-if [ -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
-	DISTMENU=`cut -f 4,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base`
-
-    if [ ! "$nonInteractive" == "YES" ]
-    then
-	    exec 5>&1
-	    EXTRA_DISTS=$(echo $DISTMENU | xargs -o bsddialog \
-	        --backtitle "$OSNAME Installer" \
-	        --title "Distribution Select" --no-cancel --separate-output \
-	        --checklist "Choose optional system components to install:" \
-	        0 0 0 \
-	    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"
+if [ ! "$nonInteractive" == "YES" ]; then
+	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
-done
-FETCH_DISTRIBUTIONS=`echo $FETCH_DISTRIBUTIONS`	# Trim white space
-
-if [ -n "$FETCH_DISTRIBUTIONS" -a -z "$BSDINSTALL_DISTSITE" ]; then
-	exec 5>&1
-	BSDINSTALL_DISTSITE=$(`dirname $0`/mirrorselect 2>&1 1>&5)
-	MIRROR_BUTTON=$?
-	exec 5>&-
-	test $MIRROR_BUTTON -eq 0 || error "No mirror selected"
-	export BSDINSTALL_DISTSITE
 fi
 
-if [ ! -z "$FETCH_DISTRIBUTIONS" ]; then
-	bsdinstall distfetch || error "Failed to fetch distribution"
+if [ "$PKGBASE" == yes ]; then
+	bsdinstall pkgbase --no-kernel || error "Installation of base system packages failed"
+else
+	distbase
 fi
 
-bsdinstall checksum || error "Distribution checksum failed"
-bsdinstall distextract || error "Distribution extract failed"
-
 if [ ! "$nonInteractive" == "YES" ]
 then
     bsdinstall rootpass || error "Could not set root password"