Index: head/share/man/man8/beinstall.8 =================================================================== --- head/share/man/man8/beinstall.8 +++ head/share/man/man8/beinstall.8 @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 18, 2020 +.Dd October 30, 2020 .Dt BEINSTALL.SH 8 .Os .Sh NAME @@ -65,10 +65,8 @@ .Nm requires a fully built world and kernel. It also requires -.Xr beadm 1 -and .Xr pkg 8 , -which are not present in the base system and have to be installed manually. +which is not present in the base system and has to be installed manually. .Pp The .Ar options @@ -82,6 +80,13 @@ User modifiable variables. Set these in the environment if desired: .Bl -tag -width indent +.It Ev BE_UTILITY Pq default: Dq Li "bectl" +Utility to manage ZFS boot environments. +This can be either +.Xr bectl 8 +from the base system or +.Xr beadm 1 +from ports (sysutils/beadm). .It Ev CONFIG_UPDATER Pq default: Dq Li "etcupdate" Config updater: .Xr etcupdate 8 @@ -110,9 +115,9 @@ lives in the src tree. .El .Sh SEE ALSO -.Xr beadm 1 , .Xr build 7 , .Xr development 7 , +.Xr bectl 8 , .Xr etcupdate 8 , .Xr mergemaster 8 , .Xr pkg 8 Index: head/tools/build/beinstall.sh =================================================================== --- head/tools/build/beinstall.sh +++ head/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 @@ 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 @@ 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 @@ 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_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 @@ 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."