diff options
author | Mateusz Piotrowski <0mp@FreeBSD.org> | 2020-10-30 09:40:55 +0000 |
---|---|---|
committer | Mateusz Piotrowski <0mp@FreeBSD.org> | 2020-10-30 09:40:55 +0000 |
commit | eb7f380f120da0248c0a9a88a5224da91ac10b0b (patch) | |
tree | 77d92b2fb6d15e73f6f8135b3e0348d2bcc0730d /tools/build | |
parent | 418b5444f8727fff383b67943b0d7d9241e61b0c (diff) | |
download | src-test-eb7f380f120da0248c0a9a88a5224da91ac10b0b.tar.gz src-test-eb7f380f120da0248c0a9a88a5224da91ac10b0b.zip |
beinstall.sh: Use bectl instead of beadm by default
This patch also introduces an environment variable BE_UTILITY,
which can be used to specify the utility to use for managing
ZFS boot environments (which can be either bectl or beadm).
While here, fix some typos in the manual page and
remove beadm from section "SEE ALSO".
Reviewed by: bcr, kevans, rpokala
Approved by: will
Differential Revision: https://reviews.freebsd.org/D21111
Notes
Notes:
svn path=/head/; revision=367159
Diffstat (limited to 'tools/build')
-rwxr-xr-x | tools/build/beinstall.sh | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/build/beinstall.sh b/tools/build/beinstall.sh index 388a3d9c7b5ad..46c65d87e61aa 100755 --- a/tools/build/beinstall.sh +++ b/tools/build/beinstall.sh @@ -30,7 +30,7 @@ # Install a boot environment using the current FreeBSD source tree. # Requires a fully built world & kernel. # -# Non-base tools required: beadm, pkg +# Non-base tools required: pkg # # In a sandbox for the new boot environment, this script also runs etcupdate # and pkg upgrade automatically in the sandbox. Upon successful completion, @@ -42,6 +42,8 @@ # beinstall [optional world/kernel flags e.g. KERNCONF] # ## User modifiable variables - set these in the environment if desired. +# Utility to manage ZFS boot environments. +BE_UTILITY="${BE_UTILITY:-"bectl"}" # If not empty, 'pkg upgrade' will be skipped. NO_PKG_UPGRADE="${NO_PKG_UPGRADE:-""}" # Config updater - 'etcupdate' and 'mergemaster' are supported. Set to an @@ -96,7 +98,7 @@ cleanup_be() { if [ -n "${created_be_dirs}" ]; then chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs} fi - beadm destroy -F ${BENAME} + ${BE_UTILITY} destroy -F ${BENAME} } create_be_dirs() { @@ -150,8 +152,8 @@ postmortem() { unmount_be rmdir_be echo "Post-mortem cleanup complete." - echo "To destroy the BE (recommended), run: beadm destroy ${BENAME}" - echo "To instead continue with the BE, run: beadm activate ${BENAME}" + echo "To destroy the BE (recommended), run: ${BE_UTILITY} destroy ${BENAME}" + echo "To instead continue with the BE, run: ${BE_UTILITY} activate ${BENAME}" } if [ -n "$BEINSTALL_CMD" ]; then @@ -159,6 +161,9 @@ if [ -n "$BEINSTALL_CMD" ]; then exit $? fi +if [ "$(basename -- "${BE_UTILITY}")" = "bectl" ]; then + ${BE_UTILITY} check || errx "${BE_UTILITY} sanity check failed" +fi cleanup_commands="" trap 'errx "Interrupt caught"' HUP INT TERM @@ -205,10 +210,10 @@ BE_MNTPT=${BE_TMP}/mnt BE_MM_ROOT=${BE_TMP}/mergemaster # mergemaster will create mkdir -p ${BE_MNTPT} -beadm create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}" +${BE_UTILITY} create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}" [ -z "$NO_CLEANUP_BE" ] && cleanup_commands="cleanup_be ${cleanup_commands}" -beadm mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}." +${BE_UTILITY} mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}." echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..." make "$@" DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!" @@ -252,8 +257,8 @@ fi unmount_be || errx "Unable to unmount BE" rmdir_be || errx "Unable to cleanup BE" -beadm activate ${BENAME} || errx "Unable to activate BE" +${BE_UTILITY} activate ${BENAME} || errx "Unable to activate BE" echo -beadm list +${BE_UTILITY} list echo echo "Boot environment ${BENAME} setup complete; reboot to use it." |