Page MenuHomeFreeBSD

release.sh: add chroot cleanup routine
ClosedPublic

Authored by ngie on Feb 23 2026, 12:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 9, 12:49 AM
Unknown Object (File)
Tue, Apr 7, 5:57 PM
Unknown Object (File)
Sat, Apr 4, 1:18 AM
Unknown Object (File)
Tue, Mar 31, 6:39 AM
Unknown Object (File)
Sat, Mar 28, 3:04 AM
Unknown Object (File)
Tue, Mar 24, 11:00 PM
Unknown Object (File)
Thu, Mar 19, 11:53 PM
Unknown Object (File)
Tue, Mar 17, 4:43 PM

Details

Summary

The chroot_cleanup routine handles any cleanup needed post-chroot_setup,
etc. This consists of purely tearing down ${CHROOTDIR}/dev today, but
might involve additional steps, as needed for custom functions. This
allows end-users to override the various chroot functions without having
to modify code in main() or replicate the unmount procedure in an
equivalent routine setup with trap(1).

This change modifies the /dev unmount process to use umount -f instead
of umount. The latter can result in failures if resources are still
mounted or are running post-build, whereas the former will clean up any
resources still in use by processes running in the chroot at time of
build. Moreover, the chroot_cleanup routine is now called when the
script is killed with SIGINT and SIGTERM, as well as at EXIT, better
ensuring that the script's resources are cleaned up in relatively common
scenarios that can be detected/handled.

While here, document override functions to aid others in overriding them.

MFC after: 1 week

Test Plan

Executing the script via: sh release/release.sh -c release/arm64/NVIDIA.conf.

Diff Detail

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

Event Timeline

ngie requested review of this revision.Feb 23 2026, 12:33 AM
ngie added a reviewer: cperciva.
ngie edited the test plan for this revision. (Show Details)
ngie added a subscriber: releng.

Personally I would put "move umount /dev into a new function" and "add comments" into different commits, but since you've already done it this way there's no point splitting them apart.

This revision is now accepted and ready to land.Sat, Mar 21, 4:56 PM

Personally I would put "move umount /dev into a new function" and "add comments" into different commits, but since you've already done it this way there's no point splitting them apart.

I'm totally fine doing that :). Adding appropriate documentation in a separate commit is the right thing to do.