Page MenuHomeFreeBSD

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

Authored by khorben_defora.org on Oct 2 2023, 7:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 8:33 PM
Unknown Object (File)
Dec 10 2023, 8:36 PM
Unknown Object (File)
Nov 18 2023, 12:42 AM
Unknown Object (File)
Oct 11 2023, 11:39 PM
Unknown Object (File)
Oct 10 2023, 5:01 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