|
Lines 7-13
Link Here
|
| 7 |
# modification, are permitted provided that the following conditions |
7 |
# modification, are permitted provided that the following conditions |
| 8 |
# are met: |
8 |
# are met: |
| 9 |
# 1. Redistributions of source code must retain the above copyright |
9 |
# 1. Redistributions of source code must retain the above copyright |
| 10 |
# notice, this list of conditions and the following disclaimer |
10 |
# notice, this list of conditions and the following disclaimer |
| 11 |
# in this position and unchanged. |
11 |
# in this position and unchanged. |
| 12 |
# 2. Redistributions in binary form must reproduce the above copyright |
12 |
# 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
# notice, this list of conditions and the following disclaimer in the |
13 |
# notice, this list of conditions and the following disclaimer in the |
|
Lines 30-36
Link Here
|
| 30 |
# Install a boot environment using the current FreeBSD source tree. |
30 |
# Install a boot environment using the current FreeBSD source tree. |
| 31 |
# Requires a fully built world & kernel. |
31 |
# Requires a fully built world & kernel. |
| 32 |
# |
32 |
# |
| 33 |
# Non-base tools required: beadm, pkg |
33 |
# Non-base tools required: beadm (if older than 12.0, uses bectl otherwise), pkg |
| 34 |
# |
34 |
# |
| 35 |
# In a sandbox for the new boot environment, this script also runs etcupdate |
35 |
# In a sandbox for the new boot environment, this script also runs etcupdate |
| 36 |
# and pkg upgrade automatically in the sandbox. Upon successful completion, |
36 |
# and pkg upgrade automatically in the sandbox. Upon successful completion, |
|
Lines 100-106
Link Here
|
| 100 |
if [ -n "${created_be_dirs}" ]; then |
100 |
if [ -n "${created_be_dirs}" ]; then |
| 101 |
chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs} |
101 |
chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs} |
| 102 |
fi |
102 |
fi |
| 103 |
beadm destroy -F ${BENAME} |
103 |
${BE_CMD} destroy -F ${BENAME} |
| 104 |
} |
104 |
} |
| 105 |
|
105 |
|
| 106 |
create_be_dirs() { |
106 |
create_be_dirs() { |
|
Lines 155-162
Link Here
|
| 155 |
unmount_be |
155 |
unmount_be |
| 156 |
rmdir_be |
156 |
rmdir_be |
| 157 |
echo "Post-mortem cleanup complete." |
157 |
echo "Post-mortem cleanup complete." |
| 158 |
echo "To destroy the BE (recommended), run: beadm destroy ${BENAME}" |
158 |
echo "To destroy the BE (recommended), run: ${BE_CMD} destroy ${BENAME}" |
| 159 |
echo "To instead continue with the BE, run: beadm activate ${BENAME}" |
159 |
echo "To instead continue with the BE, run: ${BE_CMD} activate ${BENAME}" |
| 160 |
} |
160 |
} |
| 161 |
|
161 |
|
| 162 |
if [ -n "$BEINSTALL_CMD" ]; then |
162 |
if [ -n "$BEINSTALL_CMD" ]; then |
|
Lines 175-180
Link Here
|
| 175 |
objdir=$(make -V .OBJDIR 2>/dev/null) |
175 |
objdir=$(make -V .OBJDIR 2>/dev/null) |
| 176 |
[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree" |
176 |
[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree" |
| 177 |
|
177 |
|
|
|
178 |
BE_CMD=$(which bectl) || BE_CMD=$(which beadm) |
| 179 |
|
| 178 |
# May be a worktree, in which case .git is a file, not a directory. |
180 |
# May be a worktree, in which case .git is a file, not a directory. |
| 179 |
if [ -e .git ] ; then |
181 |
if [ -e .git ] ; then |
| 180 |
commit_time=$(git show --format='%ct' 2>/dev/null | head -1) |
182 |
commit_time=$(git show --format='%ct' 2>/dev/null | head -1) |
|
Lines 206-215
Link Here
|
| 206 |
BE_MM_ROOT=${BE_TMP}/mergemaster # mergemaster will create |
208 |
BE_MM_ROOT=${BE_TMP}/mergemaster # mergemaster will create |
| 207 |
mkdir -p ${BE_MNTPT} |
209 |
mkdir -p ${BE_MNTPT} |
| 208 |
|
210 |
|
| 209 |
beadm create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}" |
211 |
${BE_CMD} create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}" |
| 210 |
[ -z "$NO_CLEANUP_BE" ] && cleanup_commands="cleanup_be ${cleanup_commands}" |
212 |
[ -z "$NO_CLEANUP_BE" ] && cleanup_commands="cleanup_be ${cleanup_commands}" |
| 211 |
|
213 |
|
| 212 |
beadm mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}." |
214 |
${BE_CMD} mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}." |
| 213 |
|
215 |
|
| 214 |
echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..." |
216 |
echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..." |
| 215 |
make "$@" DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!" |
217 |
make "$@" DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!" |
|
Lines 252-259
Link Here
|
| 252 |
|
254 |
|
| 253 |
unmount_be || errx "Unable to unmount BE" |
255 |
unmount_be || errx "Unable to unmount BE" |
| 254 |
rmdir_be || errx "Unable to cleanup BE" |
256 |
rmdir_be || errx "Unable to cleanup BE" |
| 255 |
beadm activate ${BENAME} || errx "Unable to activate BE" |
257 |
${BE_CMD} activate ${BENAME} || errx "Unable to activate BE" |
| 256 |
echo |
258 |
echo |
| 257 |
beadm list |
259 |
${BE_CMD} list |
| 258 |
echo |
260 |
echo |
| 259 |
echo "Boot environment ${BENAME} setup complete; reboot to use it." |
261 |
echo "Boot environment ${BENAME} setup complete; reboot to use it." |