Page MenuHomeFreeBSD

bsdinstall: Fix scripted examples
Needs ReviewPublic

Authored by jlduran on Fri, Jun 5, 9:31 PM.
Tags
None
Referenced Files
F161610402: D57481.diff
Sun, Jul 5, 7:26 AM
Unknown Object (File)
Fri, Jul 3, 8:43 AM
Unknown Object (File)
Fri, Jun 26, 10:03 PM
Unknown Object (File)
Fri, Jun 26, 10:43 AM
Unknown Object (File)
Fri, Jun 26, 5:13 AM
Unknown Object (File)
Thu, Jun 25, 10:54 PM
Unknown Object (File)
Sun, Jun 21, 4:39 PM
Unknown Object (File)
Sun, Jun 21, 1:20 PM

Details

Reviewers
asomers
cperciva
Group Reviewers
releng
Summary

Fix the manual page examples to account for pkgbase (the default).

While here, use the standard := parameter expansion operator to idiomatically
initialize DISTRIBUTIONS to an empty string.

Suggested by: asomers (manual page fix)
Suggested by: cperciva
MFC after: 1 week

Test Plan
  1. fetch https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/15.1/FreeBSD-15.1-RELEASE-amd64-dvd1.iso
  2. mkdir release-media
  3. tar -C release-media -xvf FreeBSD-15.1-RELEASE-amd64-dvd1.iso
  4. Test each one of the examples. Note that for pkgbase examples, BSDINSTALL_PKG_REPOS_DIR=/usr/freebsd-packages/repos must be exported, otherwise the installation will attempt to get the pkgbase packages from FreeBSD.org, and fail. The location of the examples should be: release-media/etc/installerconfig.
  5. sh /usr/src/release/amd64/mkisoimages.sh -b '15_1_RELEASE_AMD64_DVD' output.iso release-media

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73731
Build 70614: arc lint + arc unit

Event Timeline

Please commit and MFC ASAP. I'm holding RC3 for the loader issue but once that's sorted I'm going ahead and will not wait for this patch.

This revision is now accepted and ready to land.Fri, Jun 5, 10:24 PM

OK, I will commit and MFC ASAP.
I also opted for removing the pkg install step, as it may fail on -CURRENT (see attached snapshot).

Screenshot 2026-06-05 at 7.32.01 PM.png (1×1 px, 545 KB)

This revision now requires review to proceed.Fri, Jun 5, 10:36 PM

What's this about "removing the pkg install step"? I don't see anything removed.

Ahh, our comments crossed in the ether. But now that I see what you did, I request leaving "pkg install" in. IMHO it's a very important feature of the installerscript that it can install packages.

What's this about "removing the pkg install step"? I don't see anything removed.

Please try refreshing. I removed the pkg install -y puppet step. On -CURRENT it fails with the attached screenshot. The example is already clear enough enabling SSH (IMO).

Ahh, our comments crossed in the ether. But now that I see what you did, I request leaving "pkg install" in. IMHO it's a very important feature of the installerscript that it can install packages.

OK, In that case I must diagnose to see what is failing.

Ahh, our comments crossed in the ether. But now that I see what you did, I request leaving "pkg install" in. IMHO it's a very important feature of the installerscript that it can install packages.

OK, In that case I must diagnose to see what is failing.

FWIW I don't like to rely on networking functioning in the autoinstaller, so I only install packages that are on the DVD image. I do it like this:

if [ -d /dist/packages ]; then
        cp /dist/packages/repos/FreeBSD_install_cdrom.conf /etc/pkg
        /usr/sbin/pkg bootstrap -r FreeBSD_install_cdrom -y
        /usr/sbin/pkg install -r FreeBSD_install_cdrom -y sysutils/py-salt net-mgmt/lldpd
        rm /etc/pkg/FreeBSD_install_cdrom.conf
fi

Ahh, our comments crossed in the ether. But now that I see what you did, I request leaving "pkg install" in. IMHO it's a very important feature of the installerscript that it can install packages.

OK, In that case I must diagnose to see what is failing.

I see now, the DVD I was using for testing only has the pkg package.

As an observation, there is nothing wrong with the previous commit. This one is mostly a man page fix.

Update the manual page example mostly with @asomers' suggestion (a simpler version).
Note that the tmux package was chosen because it is known to be present on the DVD.

If a user wants to download packages straight from pkg.freebsd.org, when "Building Automatic Install Media", the /etc/rc.conf file must be modified to include ifconfig_DEFAULT="DHCP" (or any other method to get an IP address on the installation media, not on the chroot).

Update COMPONENTS examples:

Add:

export BSDINSTALL_PKG_REPOS_DIR=/usr/freebsd-packages/repos

Which contains FreeBSD-base-offline.conf:

FreeBSD-base: {
  url: "file:///usr/freebsd-packages/offline",
  enabled: yes
}

Otherwise, it defaults to:

local repos_dir = os.getenv("BSDINSTALL_PKG_REPOS_DIR")
if not repos_dir then
	repos_dir = "/usr/share/bsdinstall/"

and that one has FreeBSD-base.conf:

FreeBSD-base: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

Which will attempt to download from FreeBSD.org.

Update DISTRIBUTIONS example:

Showing how to configure DHCP on the scripted installer and download packages not present in the DVD.

jlduran retitled this revision from bsdinstall: Improve the fix of scripted DISTRIBUTIONS to bsdinstall: Fix scripted examples.Fri, Jun 12, 2:40 AM
jlduran edited the summary of this revision. (Show Details)
jlduran edited the test plan for this revision. (Show Details)
In D57481#1323718, @dch wrote:

committed in dd2e9aa21a45

This appears to be a completely different review attached to the committed review. The referenced commit 283959bbe0863917c4fc3200a92d1055a4c89bdc only includes the parameter expansion change to usr.sbin/bsdinstall/scripts/script. The manual changes that are currently in this review were not part of that commit. This is confusing.