Page MenuHomeFreeBSD

bsdinstall: revisit the finalconfig step
AbandonedPublic

Authored by khorben_defora.org on Aug 3 2023, 3:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 12:03 PM
Unknown Object (File)
Mon, Apr 22, 3:04 PM
Unknown Object (File)
Mon, Apr 22, 6:40 AM
Unknown Object (File)
Mon, Apr 22, 2:21 AM
Unknown Object (File)
Dec 23 2023, 12:44 AM
Unknown Object (File)
Dec 10 2023, 8:37 PM
Unknown Object (File)
Nov 5 2023, 7:22 AM
Unknown Object (File)
Nov 3 2023, 7:16 AM
Subscribers

Details

Reviewers
emaste
Summary

This commit contains the following changes:

  • moves the "finalconfig" step into a dedicated script
  • adds a "Finish" button to replace the first choice (exit and apply)
  • uses a loop instead of recursing into itself

Sponsored by: The FreeBSD Foundation

I would also like to mention that if this 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") since this menu gives a chance to perform them.

This is also relevant to D40142.

I also 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
#!/bin/sh

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 Passed
Unit
No Test Coverage
Build Status
Buildable 52957
Build 49848: arc lint + arc unit

Event Timeline

khorben_defora.org edited the test plan for this revision. (Show Details)

Respect the original copyright for the "finalconfig" code.

If you're moving code around and modifying it at the same time, please make two commits / revisions so it's much easier to review what's going on. Otherwise you have to flick back and forth between files.

If you're moving code around and modifying it at the same time, please make two commits / revisions so it's much easier to review what's going on. Otherwise you have to flick back and forth between files.

Understood, but then the intermediate state would not be functional, so it might also be counter-productive or dangerous to bring it in.

If you're moving code around and modifying it at the same time, please make two commits / revisions so it's much easier to review what's going on. Otherwise you have to flick back and forth between files.

Understood, but then the intermediate state would not be functional, so it might also be counter-productive or dangerous to bring it in.

Huh? The code is functional if you leave it alone and have the Exit entry rather than a cancel button. That’s my point; don’t make that change at the same time as moving it. Obviously you can’t always move code and literally nothing else.