Page MenuHomeFreeBSD

D52558.id162188.diff
No OneTemporary

D52558.id162188.diff

diff --git a/usr.sbin/bsdinstall/scripts/pkgbase.in b/usr.sbin/bsdinstall/scripts/pkgbase.in
--- a/usr.sbin/bsdinstall/scripts/pkgbase.in
+++ b/usr.sbin/bsdinstall/scripts/pkgbase.in
@@ -77,37 +77,40 @@
-- traditional tarball component selection dialog.
local function select_components(components, options)
local descriptions = {
- kernel_dbg = "Kernel debug info",
- base_dbg = "Base system debug info",
- src = "System source tree",
- tests = "Test suite",
- lib32 = "32-bit compatibility libraries",
- lib32_dbg = "32-bit compatibility libraries debug info",
+ ["kernel-dbg"] = "Debug symbols for the kernel",
+ ["devel"] = "C/C++ compilers and related utilities",
+ ["base"] = "The complete base system (includes devel)",
+ ["src"] = "System source tree",
+ ["tests"] = "Test suite",
+ ["lib32"] = "32-bit compatibility libraries",
+ ["debug"] = "Debug symbols for the selected components",
}
+
+ -- These defaults match what the non-pkgbase installer selects
+ -- by default.
local defaults = {
- kernel_dbg = "on",
- base_dbg = "off",
- src = "off",
- tests = "off",
- lib32 = "on",
- lib32_dbg = "off",
+ ["base"] = "on",
+ ["lib32"] = "on",
+ ["kernel-dbg"] = "on",
}
-- Sorting the components is necessary to ensure that the ordering is
-- consistent in the UI.
local sorted_components = {}
for component, _ in pairs(components) do
- table.insert(sorted_components, component)
+ -- Only include components with a description.
+ if descriptions[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 ~= "base" and component ~= "kernel" and
- not (component == "kernel_dbg" and options.no_kernel) and
- #components[component] > 0 then
+ if component ~= "kernel" and not
+ (component == "kernel-dbg" and options.no_kernel) then
local description = descriptions[component] or "''"
- local default = defaults[component] or "off"
+ local default = defaults[component] or "off"
table.insert(checklist_items, component)
table.insert(checklist_items, description)
table.insert(checklist_items, default)
@@ -120,7 +123,10 @@
"--nocancel",
"--disable-esc",
"--separate-output",
- "--checklist", "Choose optional system components to install:",
+ "--checklist",
+ "A minimal set of packages suitable for a multi-user system "..
+ "is always installed. If you want to install additional "..
+ "packages, selected them here:",
"0", "0", "0", -- autosize
}
append_list(bsddialog_args, checklist_items)
@@ -132,10 +138,12 @@
-- hopefully useful stack trace.
assert(exit_code == 0)
- local selected = {"base"}
+ local selected = {"minimal"}
+
if not options.no_kernel then
table.insert(selected, "kernel")
end
+
for component in output:gmatch("[^\n]+") do
table.insert(selected, component)
end
@@ -145,26 +153,25 @@
-- Returns a list of pkgbase packages selected by the user
local function select_packages(pkg, options)
+ -- These are the components which aren't generated automatically from
+ -- package sets.
local components = {
- kernel = {},
- kernel_dbg = {},
- base = {},
- base_dbg = {},
- src = {},
- tests = {},
+ ["kernel"] = {},
+ ["kernel-dbg"] = {},
+ ["debug"] = {},
}
for compat in all_libcompats:gmatch("%S+") do
components["lib" .. compat] = {}
- components["lib" .. compat .. "_dbg"] = {}
end
local rquery = capture(pkg .. "rquery -U -r FreeBSD-base %n")
for package in rquery:gmatch("[^\n]+") do
- if package == "FreeBSD-src" or package:match("^FreeBSD%-src%-.*") then
- table.insert(components["src"], package)
- elseif package == "FreeBSD-tests" or package:match("^FreeBSD%-tests%-.*") then
- table.insert(components["tests"], package)
+ local setname = package:match("^FreeBSD%-set%-(.+)$")
+
+ if setname then
+ components[setname] = components[setname] or {}
+ table.insert(components[setname], package)
elseif package:match("^FreeBSD%-kernel%-.*") and
package ~= "FreeBSD-kernel-man"
then
@@ -172,40 +179,57 @@
if package == "FreeBSD-kernel-generic" then
table.insert(components["kernel"], package)
elseif package == "FreeBSD-kernel-generic-dbg" then
- table.insert(components["kernel_dbg"], package)
- end
- elseif package:match(".*%-dbg$") then
- table.insert(components["base_dbg"], package)
- else
- local found = false
- for compat in all_libcompats:gmatch("%S+") do
- if package:match(".*%-dbg%-lib" .. compat .. "$") then
- table.insert(components["lib" .. compat .. "_dbg"], package)
- found = true
- break
- elseif package:match(".*%-lib" .. compat .. "$") then
- table.insert(components["lib" .. compat], package)
- found = true
- break
- end
- end
- if not found then
- table.insert(components["base"], package)
+ table.insert(components["kernel-dbg"], package)
end
end
end
+
-- Don't assert the existence of dbg, tests, and src packages here. If using
-- a custom local repository with BSDINSTALL_PKG_REPOS_DIR we shouldn't
-- require it to have all packages.
assert(#components["kernel"] == 1)
- assert(#components["base"] > 0)
+ -- At least one of base or minimal is required for the system to work.
+ assert(#components["minimal"] == 1 || #components["base"] == 1)
+
+ -- Prompt the user for what to install.
+ local selected = select_components(components, options)
+
+ -- Always install the minimal set, since it's required for the system
+ -- to work. The base set depends on minimal, but it's fine (actually,
+ -- better) to explicitly install this regardless of whether base is
+ -- installed.
+ table.insert(selected, "minimal")
+
+ -- Determine if the "debug" component was selected.
+ local debug = false
+ for _, component in ipairs(selected) do
+ if component == "debug" then
+ debug = true
+ break
+ end
+ end
- local selected = {}
- for _, component in ipairs(select_components(components, options)) do
- append_list(selected, components[component])
+ local packages = {}
+ for _, component in ipairs(selected) do
+ local pkglist = components[component]
+ append_list(packages, pkglist)
+
+ -- If the debug component was selected, install the -dbg
+ -- package for each set. We have to check if the dbg set
+ -- actually exists, because some sets (src, tests) don't
+ -- have a -dbg subpackage.
+ for _, c in ipairs(pkglist) do
+ local setname = c:match("^FreeBSD%-set%-(.*)$")
+ if debug and setname then
+ local dbgset = setname.."-dbg"
+ if components[dbgset] then
+ append_list(packages, components[dbgset])
+ end
+ end
+ end
end
- return selected
+ return packages
end
local function parse_options()

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 21, 9:11 PM (2 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
22593059
Default Alt Text
D52558.id162188.diff (6 KB)

Event Timeline