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
This commit is contained in:
parent
418b5444f8
commit
eb7f380f12
@ -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 @@ in a new boot environment.
|
||||
.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 @@ as described in
|
||||
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 @@ Place where
|
||||
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
|
||||
|
@ -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."
|
||||
|
Loading…
Reference in New Issue
Block a user