From nobody Fri Oct 3 21:51:54 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cdj6y6dlbz69JDx; Fri, 03 Oct 2025 21:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cdj6y5y4pz49GM; Fri, 03 Oct 2025 21:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759528314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qg/Cdp1ogSNf9qUlAJpWmG5Yr9l0UUQXDWwstErapCo=; b=CKyGNIGUZacHszxbnPP7cL9RYL9hzgrWagAPcZJZP3UmWtqMXJw0kOFn6DxPGQRkJ68u6n brxoTOK+j0DjRaVufXRoMnI7fDCrbaB8yJj+hCjztnmtupFASWq4huvu170vf3PAfKTO0/ kXkrJPtTZGdKTWXSFQSgHHDa4Vf6/cmY+dls2U6fZijALOv/Lqf+ONcHJ4wJ6svohRHisx Y40l2MxxLYcXUSuyHGOMlAvnbGEVU1UJyX0ZGGLpH4tT0BU0zART3VqHSnCKwAP0852CK0 8QE8nIh4dLHT3n1LJBpCoTiONB8wR9VLk6K9jHw7tLt7yT2KrzJ/T4rKRXBijQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759528314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qg/Cdp1ogSNf9qUlAJpWmG5Yr9l0UUQXDWwstErapCo=; b=SKAOIz1v1vyFbyllX1k9np+kx6DQRxD0kX+ecC7jaTJipw1xdyfqQ+W+ffoRpKaVTF28q3 MN5k/BjV57BWCrx900W4HI5fIBn0/02+2g/+XsCcTIJ4Sbq0HJoLtkz21VRx0plSxJqw17 56ow3qKhGEiqzO5GMsahwk7CZYarlX3X2YRdxrATLmbOUU+7xG+R3jqRh0it6lcoGdXljr Z8Uc7OjmFva2wZO7hvyiRy/4MIejiqojQ3hjFld3E164zZYNmYU1BkdGwNw4rMQmL6RY6f 1eQ0VbrR5w84RHM/eeoxaJz134jYRSWaXEZ3ETTQ2O1gUmF3L7A/s3RGYmjtjA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759528314; a=rsa-sha256; cv=none; b=Y2Q3gokNkdl5xTK6o5G1X9J3OpYVOHiftElNqCvaBD2kHELmQsMJYR0fIl7gn1Aur74ub/ pK3MHvpuQ1azcOcWOqY5L1T5GpD6Mag8GcNioWN1PHH63w3Pu6mpjrLwnqlrx58+S6s3D4 74jsRwy61xjPb7Nq0L7pfWTi/wuyOSvNukR5Jgfanw4OYjyUBi29FLiYVyQY9n6nLXLchK wLavPsssZ0zkUR3rBIs8h9t55nxvV+PMiW7mC4QSPIsCc7P6eakHhsKAv19Xbliaw6lCsM k9GGjkqjoSYfeaIKYPHVB2xwik2Xd+5YSe0uQhZml6DwNYczSKIr68RkGnEVDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cdj6y5Qh3z1C85; Fri, 03 Oct 2025 21:51:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 593LpsSS027944; Fri, 3 Oct 2025 21:51:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 593LpsLY027941; Fri, 3 Oct 2025 21:51:54 GMT (envelope-from git) Date: Fri, 3 Oct 2025 21:51:54 GMT Message-Id: <202510032151.593LpsLY027941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 8d0a90512ee3 - main - bsdinstall: Improve pkgbase handling for jails List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d0a90512ee35064697fbeffd0886eba4c82eb8d Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=8d0a90512ee35064697fbeffd0886eba4c82eb8d commit 8d0a90512ee35064697fbeffd0886eba4c82eb8d Author: Lexi Winter AuthorDate: 2025-10-03 21:36:30 +0000 Commit: Lexi Winter CommitDate: 2025-10-03 21:51:48 +0000 bsdinstall: Improve pkgbase handling for jails Add a new --jail option to the pkgbase script which installs jail-specific set variants if they exist: * "minimal" is replaced with "minimal-jail" * A kernel is not installed. * For sets shown in the component selection dialogue, only show the appropriate variant (jail or non-jail) for the target. Modify the jail script to pass --jail to the pkgbase script. Remove the redundant --no-kernel option, which was added in 15.0 and was only used to install jails. MFC after: 3000ms Reviewed by: ifreund_freebsdfoundation.org Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52829 --- usr.sbin/bsdinstall/bsdinstall.8 | 8 +-- usr.sbin/bsdinstall/scripts/jail | 2 +- usr.sbin/bsdinstall/scripts/pkgbase.in | 94 +++++++++++++++++++++++----------- 3 files changed, 70 insertions(+), 34 deletions(-) diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8 index 5ccbaef87835..527250d380d1 100644 --- a/usr.sbin/bsdinstall/bsdinstall.8 +++ b/usr.sbin/bsdinstall/bsdinstall.8 @@ -244,7 +244,7 @@ Extracts the distributions listed in .Ev DISTRIBUTIONS into .Ev BSDINSTALL_CHROOT . -.It Cm pkgbase Op Fl --no-kernel +.It Cm pkgbase Op Fl --jail Fetch and install base system packages to .Ev BSDINSTALL_CHROOT . Packages are fetched according to repository configuration in @@ -253,8 +253,10 @@ if set, or .Lk pkg.freebsd.org otherwise. If the -.Fl --no-kernel -option is passed, no kernel is installed. +.Fl --jail +option is passed, no kernel is installed, and the +.Dq jail +variant of each package set will be selected where applicable. .It Cm firmware executes .Xr fwget 8 diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail index 0c3c7e125fdd..f2c7ef2b37de 100755 --- a/usr.sbin/bsdinstall/scripts/jail +++ b/usr.sbin/bsdinstall/scripts/jail @@ -183,7 +183,7 @@ if [ ! "$nonInteractive" == "YES" ]; then fi if [ "$PKGBASE" == yes ]; then - bsdinstall pkgbase --no-kernel || error "Installation of base system packages failed" + bsdinstall pkgbase --jail || error "Installation of base system packages failed" else distbase fi diff --git a/usr.sbin/bsdinstall/scripts/pkgbase.in b/usr.sbin/bsdinstall/scripts/pkgbase.in index 14ef67723d59..5299d34fcb71 100755 --- a/usr.sbin/bsdinstall/scripts/pkgbase.in +++ b/usr.sbin/bsdinstall/scripts/pkgbase.in @@ -80,7 +80,9 @@ local function select_components(components, options) ["kernel-dbg"] = "Debug symbols for the kernel", ["devel"] = "C/C++ compilers and related utilities", ["optional"] = "Optional software (excluding compilers)", + ["optional-jail"] = "Optional software (excluding compilers)", ["base"] = "The complete base system (includes devel and optional)", + ["base-jail"] = "The complete base system (includes devel and optional)", ["src"] = "System source tree", ["tests"] = "Test suite", ["lib32"] = "32-bit compatibility libraries", @@ -91,6 +93,7 @@ local function select_components(components, options) -- by default. local defaults = { ["base"] = "on", + ["base-jail"] = "on", ["kernel-dbg"] = "on", } -- Enable compat sets by default. @@ -101,40 +104,66 @@ local function select_components(components, options) -- Sorting the components is necessary to ensure that the ordering is -- consistent in the UI. local sorted_components = {} + + -- Determine which components we want to offer the user. + local show_component = function (component) + -- "pkg" is always installed if present. + if component == "pkg" then return false end + + -- Don't include individual "-dbg" components, because those + -- are handled via the "debug" component, except for kernel-dbg + -- which is always shown for non-jail installations. + if component == "kernel-dbg" then + return (not options.jail) + end + if component:match("%-dbg$") then return false end + + -- Some sets have "-jail" variants which are jail-specific + -- variants of the base set. + + if options.jail and components[component.."-jail"] then + -- If we're installing in a jail, and this component + -- has a jail variant, hide it. + return false + end + + if not options.jail and component:match("%-jail$") then + -- Otherwise if we're not installing in a jail, and + -- this is a jail variant, hide it. + return false + end + + -- "minimal(-jail)" is always installed if present. + if component == "minimal" or component == "minimal-jail" then + return false + end + + -- "kernel" (the generic kernel) and "kernels" (the set) are + -- never offered; we always install the kernel for a non-jail + -- installation. + if component == "kernel" or component == "kernels" then + return false + end + + -- If we didn't find a reason to hide this component, show it. + return true + end + 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, as is - -- "pkg" if it's present. - -- - -- "-dbg" sets are never offered, because those are handled - -- via the "debug" component. - -- - -- "kernels" is never offered because we only want one kernel, - -- which is handled separately. - -- - -- Sets whose name ends in "-jail" are intended for jails, and - -- are only offered if no_kernel is set. - if component ~= "pkg" and - not component:match("^minimal") and - not (component:match("%-dbg$") and component ~= "kernel-dbg") and - not (component == "kernels") and - not (not options.no_kernel and component:match("%-jail$")) then + if show_component(component) then table.insert(sorted_components, component) end end + table.sort(sorted_components) local checklist_items = {} for _, component in ipairs(sorted_components) do - if component ~= "kernel" and not - (component == "kernel-dbg" and options.no_kernel) then - local description = descriptions[component] or "" - local default = defaults[component] or "off" - table.insert(checklist_items, component) - table.insert(checklist_items, description) - table.insert(checklist_items, default) - end + local description = descriptions[component] or "" + local default = defaults[component] or "off" + table.insert(checklist_items, component) + table.insert(checklist_items, description) + table.insert(checklist_items, default) end local bsddialog_args = { @@ -162,7 +191,12 @@ local function select_components(components, options) -- to work. The base set depends on minimal, but it's fine to install -- both, and this way the user can remove the base set without pkg -- autoremove then trying to remove minimal. - local selected = {"minimal"} + local selected = {} + if options.jail then + table.insert(selected, "minimal-jail") + else + table.insert(selected, "minimal") + end -- If pkg is available, always install it so the user can manage the -- installed system. This is optional, because a repository built @@ -171,7 +205,7 @@ local function select_components(components, options) table.insert(selected, "pkg") end - if not options.no_kernel then + if not options.jail then table.insert(selected, "kernel") end @@ -264,8 +298,8 @@ end local function parse_options() local options = {} for _, a in ipairs(arg) do - if a == "--no-kernel" then - options.no_kernel = true + if a == "--jail" then + options.jail = true else io.stderr:write("Error: unknown option " .. a .. "\n") os.exit(1)