Page MenuHomeFreeBSD

[PATCH 1/2] bsdinstall: revisit the finalconfig step
ClosedPublic

Authored by khorben on Oct 2 2023, 7:50 PM.
Tags
None
Referenced Files
F133925120: D42046.id128738.diff
Wed, Oct 29, 9:53 AM
F133924947: D42046.diff
Wed, Oct 29, 9:52 AM
Unknown Object (File)
Sep 29 2025, 4:57 AM
Unknown Object (File)
Sep 29 2025, 4:57 AM
Unknown Object (File)
Sep 29 2025, 4:57 AM
Unknown Object (File)
Sep 29 2025, 4:42 AM
Unknown Object (File)
Sep 26 2025, 6:50 PM
Unknown Object (File)
Sep 10 2025, 7:19 PM
Subscribers

Details

Summary

This moves the "finalconfig" step into a dedicated script, where it uses a loop instead of recursing into itself.

Sponsored by: The FreeBSD Foundation

In the optional [PATCH 2/2], the "finalconfig" menu will be slightly modified to be more consistent and user-friendly.

I would also like to mention that if the "finalconfig" step is not skipped (e.g., with $BSDINSTALL_SKIP_FINALCONFIG), some other steps can be skipped by default (like "adduser", "hardening", "services", and perhaps "time"). This menu gives a chance to perform these steps instead of always going through them once, and can make the installation feel faster overall.

This is also relevant to D40142.

I wish the manual configuration step could be merged into this (i.e., chrooting a shell into the newly installed system), but this conflicts with the current design of bsdinstall, which relies on a set of temporary configuration files before creating the final ones.

Test Plan

I have created a stand-alone copy of usr.sbin/bsdinstall, slightly modified in order to allow local testing without requiring a new installation image for every change.

$ git clone --branch khorben/finalconfig \
      https://github.com/khorben/bsdinstall.git
$ cd bsdinstall
$ less README.md
[...]
$ cat > test.sh << EOF

BSDINSTALLDIR="\$PWD"
DESTDIR="\$BSDINSTALLDIR/destdir"
BSDINSTALL_DISTDIR="\$DESTDIR/usr/freebsd-dist"; export BSDINSTALL_DISTDIR
SRCDIR="/usr/src"

TMPDIR="\$(mktemp -d)"; export TMPDIR
for target in "\$@"; do
    BSDCFG_SHARE="\$SRCDIR/usr.sbin/bsdconfig/share" \
        BSDINSTALL_CHROOT="\$DESTDIR" \
        BSDINSTALL_CONFIGCURRENT="yes" \
        BSDINSTALL_SCRIPTS="\$BSDINSTALLDIR/scripts" \
        ./bsdinstall "\$target"
done
EOF
$ sh test.sh auto
[perform a simulated install into the "destdir" subfolder]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable