aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsdinstall')
-rw-r--r--usr.sbin/bsdinstall/Makefile3
-rw-r--r--usr.sbin/bsdinstall/bsdinstall.831
-rw-r--r--usr.sbin/bsdinstall/partedit/gpart_ops.c14
-rw-r--r--usr.sbin/bsdinstall/partedit/part_wizard.c25
-rwxr-xr-xusr.sbin/bsdinstall/scripts/auto9
-rwxr-xr-xusr.sbin/bsdinstall/scripts/bootconfig61
-rwxr-xr-xusr.sbin/bsdinstall/scripts/jail10
-rwxr-xr-xusr.sbin/bsdinstall/scripts/keymap2
-rwxr-xr-xusr.sbin/bsdinstall/scripts/pkgbase.in239
-rwxr-xr-xusr.sbin/bsdinstall/scripts/script2
-rwxr-xr-xusr.sbin/bsdinstall/scripts/services49
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot44
12 files changed, 326 insertions, 163 deletions
diff --git a/usr.sbin/bsdinstall/Makefile b/usr.sbin/bsdinstall/Makefile
index e5bb3197fa05..5d7be97ed7cf 100644
--- a/usr.sbin/bsdinstall/Makefile
+++ b/usr.sbin/bsdinstall/Makefile
@@ -22,7 +22,8 @@ REVISION?= ${_REVISION}
.if ${BRANCH} == CURRENT || ${BRANCH} == STABLE
SUBURL= base_latest
-.elif ${BRANCH} == RELEASE
+.elif ${BRANCH} == RELEASE || ${BRANCH:C/[0-9]+$//} == BETA || \
+ ${BRANCH:C/[0-9]+$//} == RC
SUBURL= base_release_${REVISION:C/[0-9]+\.//}
.else
.warning Invalid branch "${BRANCH}"
diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8
index 181abdcf9d05..ee141e1d4296 100644
--- a/usr.sbin/bsdinstall/bsdinstall.8
+++ b/usr.sbin/bsdinstall/bsdinstall.8
@@ -1,4 +1,6 @@
-.\"-
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
.\" Copyright (c) 2011-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org> All rights reserved.
.\" Copyright (c) 2018 Roberto Fernandez Cueto <roberfern@gmail.com>
.\" Copyright (c) 2024 The FreeBSD Foundation
@@ -27,7 +29,7 @@
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd November 4, 2024
+.Dd October 3, 2025
.Dt BSDINSTALL 8
.Os
.Sh NAME
@@ -40,9 +42,10 @@
.Op Ar ...
.Sh DESCRIPTION
.Nm
-is used for installation of new systems, both for system setup from
-installation media, e.g., CD-ROMs, and for use on live systems to prepare
-VM images and jails.
+is used for installation of new systems,
+both for system setup from installation media,
+such as discs, USBs, or network boot environments,
+and for use on live systems to prepare jails and virtual machine images.
.Pp
Much like
.Xr make 1 , Nm
@@ -56,7 +59,7 @@ these subtargets can be invoked separately by an installation script.
.Sh OPTIONS
.Nm
supports the following options, global to all targets:
-.Bl -tag -width indent+
+.Bl -tag -width "-D file"
.It Fl D Ar file
Provide a path for the installation log file
.Pq overrides Ev BSDINSTALL_LOG .
@@ -73,7 +76,7 @@ For interactive use, most users will be interested only in the
and
.Cm script
targets.
-.Bl -tag -width "jail destination"
+.Bl -tag -width "-D file"
.It Cm auto
Run the standard interactive installation, including disk partitioning.
.It Cm jail Ar destination
@@ -244,7 +247,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 +256,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
@@ -293,7 +298,7 @@ Many are used internally during installation and have reasonable default values
for most installation scenarios.
Others are set by various interactive user prompts, and can be usefully
overridden when making scripted or customized installers.
-.Bl -tag -width "BSDINSTALL_DISTSITE"
+.Bl -tag -width "-D file"
.It Ev TMPDIR
The directory to use for temporary files.
Default:
@@ -693,7 +698,7 @@ is:
# Home directories separated so they are common to all BEs
/home mountpoint=/home
-# Compress /tmp, allow exec but not setuid
+# Create /tmp and allow exec but not setuid
/tmp mountpoint=/tmp,exec=on,setuid=off
# Do not mount /usr so that 'base' files go to the BEROOT
@@ -702,7 +707,7 @@ is:
# Ports tree
/usr/ports setuid=off
-# Source tree (compressed)
+# Source tree
/usr/src
# Create /var and friends
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c
index 0bcd17950daf..8da85a805545 100644
--- a/usr.sbin/bsdinstall/partedit/gpart_ops.c
+++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c
@@ -139,16 +139,16 @@ newfs_command(const char *fstype, int use_default)
} else if (strcmp(fstype, "freebsd-zfs") == 0) {
int i;
struct bsddialog_menuitem items[] = {
- {"", 0, true, "fletcher4", "checksum algorithm: fletcher4",
+ {"", true, 0, "fletcher4", "checksum algorithm: fletcher4",
"Use fletcher4 for data integrity checking. "
"(default)"},
- {"", 0, false, "fletcher2", "checksum algorithm: fletcher2",
+ {"", false, 0, "fletcher2", "checksum algorithm: fletcher2",
"Use fletcher2 for data integrity checking. "
"(not recommended)"},
- {"", 0, false, "sha256", "checksum algorithm: sha256",
+ {"", false, 0, "sha256", "checksum algorithm: sha256",
"Use sha256 for data integrity checking. "
"(not recommended)"},
- {"", 0, false, "atime", "Update atimes for files",
+ {"", false, 0, "atime", "Update atimes for files",
"Disable atime update"},
};
@@ -188,11 +188,11 @@ newfs_command(const char *fstype, int use_default)
strcmp(fstype, "ms-basic-data") == 0) {
int i;
struct bsddialog_menuitem items[] = {
- {"", 0, true, "FAT32", "FAT Type 32",
+ {"", true, 0, "FAT32", "FAT Type 32",
"Create a FAT32 filesystem (default)"},
- {"", 0, false, "FAT16", "FAT Type 16",
+ {"", false, 0, "FAT16", "FAT Type 16",
"Create a FAT16 filesystem"},
- {"", 0, false, "FAT12", "FAT Type 12",
+ {"", false, 0, "FAT12", "FAT Type 12",
"Create a FAT12 filesystem"},
};
diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c
index 90a8da1c3c9b..9146a2af782f 100644
--- a/usr.sbin/bsdinstall/partedit/part_wizard.c
+++ b/usr.sbin/bsdinstall/partedit/part_wizard.c
@@ -27,6 +27,7 @@
*/
#include <sys/param.h>
+#include <sys/sysctl.h>
#include <errno.h>
#include <inttypes.h>
@@ -34,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <libgeom.h>
#include <bsddialog.h>
@@ -41,10 +43,29 @@
#include "partedit.h"
#define MIN_FREE_SPACE (1023*1024*1024) /* Just under 1 GB */
-#define SWAP_SIZE(available) MIN(available/20, 4*1024*1024*1024LL)
static char *wizard_partition(struct gmesh *mesh, const char *disk);
+/*
+ * Determine default swap (partition) size in bytes for a given amount of free
+ * disk space in bytes. The algorithm should likely be revisited in light of
+ * contemporary memory and disk sizes.
+ */
+static intmax_t
+swap_size(intmax_t available)
+{
+ intmax_t swapsize;
+ unsigned long swap_maxpages;
+ size_t sz;
+
+ swapsize = MIN(available/20, 4*1024*1024*1024LL);
+ sz = sizeof(swap_maxpages);
+ if (sysctlbyname("vm.swap_maxpages", &swap_maxpages, &sz, NULL, 0) == 0)
+ swapsize = MIN(swapsize, (intmax_t)swap_maxpages * getpagesize());
+
+ return (swapsize);
+}
+
int
part_wizard(const char *fsreq)
{
@@ -383,7 +404,7 @@ wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype,
return (!retval); /* Editor -> return 0 */
}
- swapsize = SWAP_SIZE(available);
+ swapsize = swap_size(available);
humanize_number(swapsizestr, 7, swapsize, "B", HN_AUTOSCALE,
HN_NOSPACE | HN_DECIMAL);
humanize_number(rootsizestr, 7, available - swapsize - 1024*1024,
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index 0b47d496fdbd..5fefc07e4c07 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -73,7 +73,7 @@ msg_yes="YES"
# error [$msg]
#
# Display generic error message when a script fails. An optional message
-# argument can preceed the generic message. User is given the choice of
+# argument can precede the generic message. User is given the choice of
# restarting the installer or exiting.
#
error()
@@ -178,6 +178,9 @@ environment_save
rm -rf $BSDINSTALL_TMPETC
mkdir $BSDINSTALL_TMPETC
+# Reset the ESP list
+: > ${TMPDIR:-"/tmp"}/bsdinstall-esps
+
# With pkgbase, pkg OOM has been observed with QEMU-default 128 MiB memory size.
# Ensure we have at least about 256 MiB (with an allowance for rounding etc.).
physmem=$(($(sysctl -n hw.physmem) / 1048576))
@@ -206,9 +209,9 @@ if [ ! -f $BSDINSTALL_DISTDIR/MANIFEST ]; then
PKGBASE=yes
else
bsddialog --backtitle "$OSNAME Installer" --title "Select Installation Type" \
- --yes-label "Traditional" --no-label "Packages (Experimental)" --yesno \
+ --yes-label "Distribution Sets" --no-label "Packages (Tech Preview)" --yesno \
$PKGBASE_DEFAULT_BUTTON \
- "Would you like to install the base system using traditional distribution sets or packages (experimental)?" 0 0
+ "Would you like to install the base system using traditional distribution sets or packages (technology preview)?" 0 0
if [ $? -eq 1 ]; then
PKGBASE=yes
fi
diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig
index 41243ad14b9b..9c188c1d8a91 100755
--- a/usr.sbin/bsdinstall/scripts/bootconfig
+++ b/usr.sbin/bsdinstall/scripts/bootconfig
@@ -63,6 +63,24 @@ dialog_uefi_entryname()
2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
}
+# Copy to the normal FreeBSD location. Also copy to the default location if it
+# doesn't exist. This covers setups where UEFI NV variables can't be set and
+# some buggy firmware, while preserving complex UEFI setups for multiple booting
+# (rEFInd, etc).
+uefi_copy_loader()
+{
+ local ldr=$1
+ local freebsd_dir=$2
+ local default_dir=$3
+ local dest=$4
+
+ mkdir -p "${freebsd_dir}" "${default_dir}"
+ cp "${ldr}" "${freebsd_dir}"
+ if [ ! -f "${default_dir}/${dest}" ]; then
+ cp "${ldr}" "${default_dir}/${dest}"
+ fi
+}
+
update_uefi_bootentry()
{
nentries=$(efibootmgr | grep -c "${EFI_LABEL_NAME}$")
@@ -113,6 +131,7 @@ if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then
*) die "Unsupported arch $(uname -m) for UEFI install"
esac
+ # Support the weird 32-bit firmware loading 64-bit kernels
if [ `sysctl -n machdep.efi_arch` == i386 ]; then
ARCHBOOTNAME=ia32
file=loader_ia32.efi
@@ -120,31 +139,31 @@ if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then
file=loader.efi
fi
- BOOTDIR="/efi/boot"
- BOOTNAME="${BOOTDIR}/boot${ARCHBOOTNAME}.efi"
- FREEBSD_BOOTDIR="/efi/freebsd"
- FREEBSD_BOOTNAME="${FREEBSD_BOOTDIR}/${file}"
+ # Copy the boot loader
mntpt="$BSDINSTALL_CHROOT/boot/efi"
-
f_dprintf "Installing ${file} onto ESP"
- mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}"
- cp "$BSDINSTALL_CHROOT/boot/${file}" "${mntpt}/${FREEBSD_BOOTNAME}"
-
- #
- # UEFI defines a way to specifically select what to boot
- # (which we do via efibootmgr). However, if we booted from an ia32
- # UEFI environment, we wouldn't have access to efirt. In addition,
- # virtual environments often times lack support for the NV variables
- # efibootmgr sets, and some UEFI implementations have features that
- # interfere with the setting of these variables. To combat that, we
- # install the default removable media boot file if it doesn't exist.
- # We don't install it all the time since that can interfere with other
- # installations on the drive (like rEFInd).
- #
- if [ ! -f "${mntpt}/${BOOTNAME}" ]; then
- cp "$BSDINSTALL_CHROOT/boot/${file}" "${mntpt}/${BOOTNAME}"
+ uefi_copy_loader "$BSDINSTALL_CHROOT/boot/${file}" \
+ "${mntpt}/efi/freebsd" "${mntpt}/efi/boot" \
+ boot${ARCHBOOTNAME}.efi
+
+ # zfsboot records the extra esp partitions it creates to -esps. These
+ # are newfs'd at the time of creation. We don't support installing ufs
+ # over gmirror, so we only do this for ZFS.
+ esps=${TMPDIR:-"/tmp"}/bsdinstall-esps
+ if [ -f "$esps" ]; then
+ mntpt=$(mktemp -d -t bsdinstall-esp)
+ for dev in $(cat $esps); do
+ f_dprintf "Installing ${file} onto redundant ESP ${dev}"
+ mount -t msdos "$dev" "$mntpt"
+ uefi_copy_loader "$BSDINSTALL_CHROOT/boot/${file}" \
+ "${mntpt}/efi/freebsd" "${mntpt}/efi/boot" \
+ boot${ARCHBOOTNAME}.efi
+ umount "$mntpt"
+ done
+ rmdir "${mntpt}"
fi
+ # Try to set the UEFI NV BootXXXX variables to record the boot location
if [ "$BSDINSTALL_CONFIGCURRENT" ] && [ "$ARCHBOOTNAME" != ia32 ]; then
update_uefi_bootentry
fi
diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail
index 0c3c7e125fdd..e4238ac0a687 100755
--- a/usr.sbin/bsdinstall/scripts/jail
+++ b/usr.sbin/bsdinstall/scripts/jail
@@ -45,7 +45,7 @@ user_env_vars="BSDINSTALL_DISTSITE DISTRIBUTIONS"
# error [$msg]
#
# Display generic error message when a script fails. An optional message
-# argument can preceed the generic message. User is given the choice of
+# argument can precede the generic message. User is given the choice of
# restarting the installer or exiting.
#
error() {
@@ -79,7 +79,7 @@ distbase() {
: ${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`
+ DISTMENU=$(cut -f 1,5,6 $BSDINSTALL_DISTDIR/MANIFEST | grep -v -e ^kernel -e ^base | sed -E 's/\.txz//g')
if [ ! "$nonInteractive" == "YES" ]
then
@@ -175,15 +175,15 @@ fi
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
+ --yes-label "Distribution Sets" --no-label "Packages (Tech Preview)" --yesno \
+ "Would you like to install the base system using traditional distribution sets or packages (technology preview)?" 0 0
if [ $? -eq 1 ]; then
PKGBASE=yes
fi
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/keymap b/usr.sbin/bsdinstall/scripts/keymap
index 6f4060c0772e..669a1062df95 100755
--- a/usr.sbin/bsdinstall/scripts/keymap
+++ b/usr.sbin/bsdinstall/scripts/keymap
@@ -216,7 +216,7 @@ while :; do
n=$( eval f_dialog_menutag2index_with_help \
\"\$menu_choice\" $menu_list )
- # Turn that number ithe name of the keymap struct
+ # Turn that number into the name of the keymap struct
k=$( set -- $KEYMAPS; eval echo \"\${$(( $n - 2))}\" )
# Get actual keymap setting while we update $keymap and $KEYMAPFILE
diff --git a/usr.sbin/bsdinstall/scripts/pkgbase.in b/usr.sbin/bsdinstall/scripts/pkgbase.in
index d123394c170e..5299d34fcb71 100755
--- a/usr.sbin/bsdinstall/scripts/pkgbase.in
+++ b/usr.sbin/bsdinstall/scripts/pkgbase.in
@@ -77,41 +77,93 @@ end
-- 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",
+ ["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",
+ ["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",
+ ["base-jail"] = "on",
+ ["kernel-dbg"] = "on",
}
+ -- Enable compat sets by default.
+ for compat in all_libcompats:gmatch("%S+") do
+ defaults["lib" .. compat] = "on"
+ end
-- 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
- table.insert(sorted_components, component)
+ 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 ~= "base" and component ~= "kernel" and
- not (component == "kernel_dbg" and options.no_kernel) and
- #components[component] > 0 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 = {
@@ -120,7 +172,10 @@ local function select_components(components, options)
"--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. Select additional packages you wish "..
+ "to install:",
"0", "0", "0", -- autosize
}
append_list(bsddialog_args, checklist_items)
@@ -132,10 +187,28 @@ local function select_components(components, options)
-- hopefully useful stack trace.
assert(exit_code == 0)
- local selected = {"base"}
- if not options.no_kernel then
+ -- Always install the minimal set, since it's required for the system
+ -- 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 = {}
+ 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
+ -- from src alone won't have a pkg package.
+ if components["pkg"] then
+ table.insert(selected, "pkg")
+ end
+
+ if not options.jail then
table.insert(selected, "kernel")
end
+
for component in output:gmatch("[^\n]+") do
table.insert(selected, component)
end
@@ -145,74 +218,88 @@ end
-- 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
+ -- Note: if you update this list, you must also update the list in
+ -- release/scripts/pkgbase-stage.lua.
+ local kernel_packages = {
+ -- Most architectures use this
+ ["FreeBSD-kernel-generic"] = true,
+ -- PowerPC uses either of these, depending on platform
+ ["FreeBSD-kernel-generic64"] = true,
+ ["FreeBSD-kernel-generic64le"] = true,
+ }
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)
- elseif package:match("^FreeBSD%-kernel%-.*") and
- package ~= "FreeBSD-kernel-man"
- then
- -- Kernels other than FreeBSD-kernel-generic are ignored
- 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)
- end
+ local setname = package:match("^FreeBSD%-set%-(.+)$")
+
+ if setname then
+ components[setname] = components[setname] or {}
+ table.insert(components[setname], package)
+ elseif kernel_packages[package] then
+ 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
- -- 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 that both a kernel and the "minimal" set are available, since
+ -- those are both required to install a functional system. Don't worry
+ -- if other sets are missing (e.g. base or src), which might happen
+ -- when using custom install media.
assert(#components["kernel"] == 1)
- assert(#components["base"] > 0)
+ assert(#components["minimal"] == 1)
- local selected = {}
- for _, component in ipairs(select_components(components, options)) do
- append_list(selected, components[component])
+ -- Prompt the user for what to install.
+ local selected = select_components(components, options)
+
+ -- 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
- return selected
+ 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 packages
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)
diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script
index 00ded5f8e24d..21da2ea7c366 100755
--- a/usr.sbin/bsdinstall/scripts/script
+++ b/usr.sbin/bsdinstall/scripts/script
@@ -144,7 +144,7 @@ else
#
# Work around this in an extremely lame way for the specific
# case of EFI system partitions only. This *ONLY WORKS* if
- # /boot/efi is empty and does not handle analagous problems on
+ # /boot/efi is empty and does not handle analogous problems on
# other systems (ARM, PPC64).
tar -xf "$BSDINSTALL_DISTDIR/$set" -C $BSDINSTALL_CHROOT --exclude boot/efi
mkdir -p $BSDINSTALL_CHROOT/boot/efi
diff --git a/usr.sbin/bsdinstall/scripts/services b/usr.sbin/bsdinstall/scripts/services
index 93282effbb3f..110b6f321ed1 100755
--- a/usr.sbin/bsdinstall/scripts/services
+++ b/usr.sbin/bsdinstall/scripts/services
@@ -40,21 +40,44 @@ fi
echo -n > $BSDINSTALL_TMPETC/rc.conf.services
+DAEMON_OPTIONS=""
+
+if [ -x "${BSDINSTALL_CHROOT}/etc/rc.d/sshd" ]; then
+ DAEMON_OPTIONS="$DAEMON_OPTIONS \
+ sshd \"Secure shell daemon\" ${sshd_enable:-off}"
+fi
+
+if [ -x "${BSDINSTALL_CHROOT}/etc/rc.d/ntpd" ]; then
+ DAEMON_OPTIONS="$DAEMON_OPTIONS \
+ ntpd \"Synchronize system and network time\" ${ntpd_enable:-off} \
+ ntpd_sync_on_start \"Sync time on ntpd startup, even if offset is high\" \
+ ${ntpd_sync_on_start:-off}"
+fi
+
+if [ -x "${BSDINSTALL_CHROOT}/etc/rc.d/local_unbound" ]; then
+ DAEMON_OPTIONS="$DAEMON_OPTIONS \
+ local_unbound \"Local caching validating resolver\" \
+ ${local_unbound_enable:-off}"
+fi
+
+if [ -x "${BSDINSTALL_CHROOT}/etc/rc.d/powerd" ]; then
+ DAEMON_OPTIONS="$DAEMON_OPTIONS \
+ powerd \"Adjust CPU frequency dynamically if supported\" \
+ ${powerd_enable:-off}"
+fi
+
+if [ -x "${BSDINSTALL_CHROOT}/etc/rc.d/moused" ]; then
+ DAEMON_OPTIONS="$DAEMON_OPTIONS \
+ moused \"PS/2 mouse pointer on console\" ${moused_enable:-off}"
+fi
+
exec 5>&1
-DAEMONS=$( bsddialog --backtitle "$OSNAME Installer" \
- --title "System Configuration" --no-cancel --separate-output \
- --checklist "Choose the services you would like to be started at boot:" \
+DAEMONS=$(eval bsddialog --backtitle \"$OSNAME Installer\" \
+ --title \"System Configuration\" --no-cancel --separate-output \
+ --checklist \"Choose the services you would like to be started at boot:\" \
0 0 0 \
- local_unbound "Local caching validating resolver" \
- ${local_unbound_enable:-off} \
- sshd "Secure shell daemon" ${sshd_enable:-off} \
- moused "PS/2 mouse pointer on console" ${moused_enable:-off} \
- ntpd "Synchronize system and network time" ${ntpd_enable:-off} \
- ntpd_sync_on_start "Sync time on ntpd startup, even if offset is high" \
- ${ntpd_sync_on_start:-off} \
- powerd "Adjust CPU frequency dynamically if supported" \
- ${powerd_enable:-off} \
- dumpdev "Enable kernel crash dumps to /var/crash" ${dumpdev:-on} \
+ $DAEMON_OPTIONS \
+ dumpdev \"Enable kernel crash dumps to /var/crash\" ${dumpdev:-on} \
2>&1 1>&5 )
retval=$?
exec 5>&-
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index a3c1e2ddb89f..a4c9220a709c 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -69,7 +69,7 @@ f_include $BSDCFG_SHARE/variable.subr
: ${ZFSBOOT_VDEV_TYPE:=stripe}
#
-# Should we use sysctl(8) vfs.zfs.min_auto_ashift=12 to force 4K sectors?
+# Should we use sysctl(8) vfs.zfs.vdev.min_auto_ashift=12 to force 4K sectors?
#
: ${ZFSBOOT_FORCE_4K_SECTORS=1}
@@ -152,7 +152,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATASETS="
# Home directories separated so they are common to all BEs
/home mountpoint=/home
- # Compress /tmp, allow exec but not setuid
+ # Create /tmp and allow exec but not setuid
/tmp mountpoint=/tmp,exec=on,setuid=off
# Don't mount /usr so that 'base' files go to the BEROOT
@@ -161,7 +161,7 @@ f_isset ZFSBOOT_DATASETS || ZFSBOOT_DATASETS="
# Ports tree
/usr/ports setuid=off
- # Source tree (compressed)
+ # Source tree
/usr/src
# Create /var and friends
@@ -216,12 +216,12 @@ KLDLOAD='kldload %s'
LN_SF='ln -sf "%s" "%s"'
MKDIR_P='mkdir -p "%s"'
MOUNT_TYPE='mount -t %s "%s" "%s"'
-NEWFS_ESP='newfs_msdos "%s"'
+NEWFS_ESP='newfs_msdos -F 32 -c 1 "%s"'
PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\""
PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"'
SHELL_TRUNCATE=':> "%s"'
SWAP_GMIRROR_LABEL='gmirror label swap %s'
-SYSCTL_ZFS_MIN_ASHIFT_12='sysctl vfs.zfs.min_auto_ashift=12'
+SYSCTL_ZFS_MIN_ASHIFT_12='sysctl vfs.zfs.vdev.min_auto_ashift=12'
UMOUNT='umount "%s"'
ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"'
ZFS_MOUNT='zfs mount "%s"'
@@ -255,7 +255,7 @@ msg_encrypt_disks="Encrypt Disks?"
msg_encrypt_disks_help="Use geli(8) to encrypt all data partitions"
msg_error="Error"
msg_force_4k_sectors="Force 4K Sectors?"
-msg_force_4k_sectors_help="Align partitions to 4K sector boundries and set vfs.zfs.min_auto_ashift=12"
+msg_force_4k_sectors_help="Align partitions to 4K sector boundaries and set vfs.zfs.vdev.min_auto_ashift=12"
msg_freebsd_installer="$OSNAME Installer"
msg_geli_password="Enter a strong passphrase, used to protect your encryption keys. You will be required to enter this passphrase each time the system is booted"
msg_geli_setup="Initializing encryption on selected disks,\n this will take several seconds per disk"
@@ -760,6 +760,7 @@ zfs_create_diskpart()
{
local funcname=zfs_create_diskpart
local disk="$1" index="$2"
+ local efibootpart
# Check arguments
if [ ! "$disk" ]; then
@@ -867,18 +868,22 @@ zfs_create_diskpart()
$disk || return $FAILURE
# We'll configure the ESP in bootconfig
- if [ -z "$efibootpart" ]; then
- efibootpart="/dev/gpt/efiboot$index"
- f_dprintf "$funcname: configuring ESP at [%s]" \
- "${efibootpart}"
-
- f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\
- "$efibootpart" \
- || return $FAILURE
+ # Note: This will always be p1
+ efibootpart="/dev/gpt/efiboot$index"
+ f_dprintf "$funcname: configuring ESP at [%s]" \
+ "${efibootpart}"
+
+ f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\
+ "$efibootpart" \
+ || return $FAILURE
+ if [ $index -eq 0 ]; then
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
- $efibootpart /boot/efi msdosfs \
- rw 2 2 "$BSDINSTALL_TMPETC/fstab" \
- || return $FAILURE
+ $efibootpart /boot/efi msdosfs \
+ rw 2 2 "$BSDINSTALL_TMPETC/fstab" \
+ || return $FAILURE
+ else
+ # Record the extra ones
+ echo "${efibootpart}" >> ${TMPDIR:-"/tmp"}/bsdinstall-esps
fi
fi
@@ -1021,7 +1026,6 @@ zfs_create_boot()
local isswapmirror
local bootpart targetpart swappart # Set by zfs_create_diskpart() below
local create_options
- local efibootpart
#
# Pedantic checks; should never be seen
@@ -1099,7 +1103,7 @@ zfs_create_boot()
#
f_dprintf "$funcname: Preparing disk partitions for ZFS pool..."
- # Force 4K sectors using vfs.zfs.min_auto_ashift=12
+ # Force 4K sectors using vfs.zfs.vdev.min_auto_ashift=12
if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
f_dprintf "$funcname: With 4K sectors..."
f_eval_catch $funcname sysctl "$SYSCTL_ZFS_MIN_ASHIFT_12" \
@@ -1382,7 +1386,7 @@ zfs_create_boot()
if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
f_eval_catch $funcname echo "$ECHO_APPEND" \
- 'vfs.zfs.min_auto_ashift=12' \
+ 'vfs.zfs.vdev.min_auto_ashift=12' \
$BSDINSTALL_TMPETC/sysctl.conf.zfs || return $FAILURE
fi