Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2025 09:16:56 GMT
From:      Lexi Winter <ivy@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4422265c67b8 - main - bsdinstall: Install pkg if it's available
Message-ID:  <202509240916.58O9GuZt001770@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ivy:

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

commit 4422265c67b8a4e19da08fdf5504a7b5e278f815
Author:     Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2025-09-24 00:10:02 +0000
Commit:     Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2025-09-24 09:16:13 +0000

    bsdinstall: Install pkg if it's available
    
    Now that the pkg package is shipped on the pkgbase release media,
    install it by default for a pkgbase install if it's present.
    
    If it's not available (e.g., when running bsdinstall from a repository
    built from src alone, without ports), skip it and assume the user will
    install it another way.
    
    MFC after:      1 day
    Reviewed by:    ifreund_freebsdfoundation.org, cperciva
    Differential Revision:  https://reviews.freebsd.org/D52639
---
 usr.sbin/bsdinstall/scripts/pkgbase.in | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/pkgbase.in b/usr.sbin/bsdinstall/scripts/pkgbase.in
index 3ba6a3474e0f..0b7554644028 100755
--- a/usr.sbin/bsdinstall/scripts/pkgbase.in
+++ b/usr.sbin/bsdinstall/scripts/pkgbase.in
@@ -103,7 +103,8 @@ local function select_components(components, options)
 	for component, _ in pairs(components) do
 		-- Decide which sets we want to offer to the user:
 		--
-		-- "minimal" is not offered since it's always included.
+		-- "minimal" is not offered since it's always included, as is
+		-- "pkg" if it's present.
 		--
 		-- "-dbg" sets are never offered, because those are handled
 		-- via the "debug" component.
@@ -113,7 +114,8 @@ local function select_components(components, options)
 		--
 		-- Sets whose name ends in "-jail" are intended for jails, and
 		-- are only offered if no_kernel is set.
-		if not component:match("^minimal") and
+		if component ~= "pkg" and
+		   not component:match("^minimal") and
 		   not component:match("%-dbg$") and
 		   not (component == "kernels") and
 		   not (not options.no_kernel and component:match("%-jail$")) then
@@ -161,6 +163,13 @@ local function select_components(components, options)
 	-- autoremove then trying to remove minimal.
 	local selected = {"minimal"}
 
+	-- If pkg is available, always install it so the user can manage the
+	-- installed system.  This is optional, because a repository built
+	-- from src alone won't have a pkg package.
+	if components["pkg"] then
+		table.insert(selected, "pkg")
+	end
+
 	if not options.no_kernel then
 		table.insert(selected, "kernel")
 	end
@@ -203,6 +212,9 @@ local function select_packages(pkg, options)
 			table.insert(components["kernel"], package)
 		elseif kernel_packages[package:match("(.*)%-dbg$")] then
 			table.insert(components["kernel-dbg"], package)
+		elseif package == "pkg" then
+			components["pkg"] = components["pkg"] or {}
+			table.insert(components["pkg"], package)
 		end
 	end
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509240916.58O9GuZt001770>