git: cc413e2c04f0 - main - bsdinstall: Always install FreeBSD-base.conf if using pkgbase

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 21 Jul 2025 19:29:37 UTC
The branch main has been updated by emaste:

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

commit cc413e2c04f0b1456fd4636d33dedd2e01088f80
Author:     Isaac Freund <ifreund@freebsdfoundation.org>
AuthorDate: 2025-07-01 10:09:21 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-07-21 19:29:04 +0000

    bsdinstall: Always install FreeBSD-base.conf if using pkgbase
    
    Currently bsdinstall does not install FreeBSD-base.conf when performing
    an offline pkgbase installation. This commit fixes that.
    
    PR:             287821
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D51101
---
 usr.sbin/bsdinstall/scripts/pkgbase.in | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/pkgbase.in b/usr.sbin/bsdinstall/scripts/pkgbase.in
index 1ff93afe817b..cf8e84de6923 100755
--- a/usr.sbin/bsdinstall/scripts/pkgbase.in
+++ b/usr.sbin/bsdinstall/scripts/pkgbase.in
@@ -234,12 +234,17 @@ local function pkgbase()
 	local chroot = assert(os.getenv("BSDINSTALL_CHROOT"))
 	assert(os.execute("mkdir -p " .. chroot))
 
+	-- Always install the default FreeBSD-base.conf file to the chroot, even
+	-- if we don't actually fetch the packages from the repository specified
+	-- there (e.g. because we are performing an offline installation).
+	local chroot_repos_dir = chroot .. "/usr/local/etc/pkg/repos/"
+	assert(os.execute("mkdir -p " .. chroot_repos_dir))
+	assert(os.execute("cp /usr/share/bsdinstall/FreeBSD-base.conf " ..
+		chroot_repos_dir))
+
 	local repos_dir = os.getenv("BSDINSTALL_PKG_REPOS_DIR")
 	if not repos_dir then
-		repos_dir = chroot .. "/usr/local/etc/pkg/repos/"
-		assert(os.execute("mkdir -p " .. repos_dir))
-		assert(os.execute("cp /usr/share/bsdinstall/FreeBSD-base.conf " .. repos_dir))
-
+		repos_dir = chroot_repos_dir
 		-- Since pkg always interprets fingerprints paths as relative to
 		-- the --rootdir we must copy the key from the host.
 		assert(os.execute("mkdir -p " .. chroot .. "/usr/share/keys"))