Page MenuHomeFreeBSD

release.sh: add chroot cleanup routine
Needs ReviewPublic

Authored by ngie on Mon, Feb 23, 12:33 AM.

Details

Reviewers
cperciva
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