Lines Matching +full:boot +full:- +full:up
29 # Install a boot environment using the current FreeBSD source tree.
32 # Non-base tools required: pkg
34 # In a sandbox for the new boot environment, this script also runs etcupdate
36 # the system will be ready to boot into the new boot environment. Upon
37 # failure, the target boot environment will be destroyed. In all cases, the
43 ## User modifiable variables - set these in the environment if desired.
44 # Utility to manage ZFS boot environments.
45 BE_UTILITY="${BE_UTILITY:-"bectl"}"
47 NO_PKG_UPGRADE="${NO_PKG_UPGRADE:-""}"
48 # Config updater - 'etcupdate' is supported. Set to an empty string to skip.
49 CONFIG_UPDATER="${CONFIG_UPDATER:-"etcupdate"}"
51 ETCUPDATE_FLAGS="${ETCUPDATE_FLAGS:-"-BF"}"
57 [ -z "${cleanup_commands}" ] && return
58 echo "Cleaning up ..."
71 chflags -R noschg ${BE_MNTPT}
72 rm -rf ${BE_MNTPT}
76 mount | grep " on ${BE_MNTPT}" | awk '{print $3}' | sort -r | xargs -t umount -f
80 # Before cleaning up, try to save progress in pkg(8) updates, to
81 # speed up future updates. This is only called on the error path;
84 rsync -av --progress ${BE_MNTPT}/var/cache/pkg/. /var/cache/pkg/.
89 # been mounted under the boot environment. Sort them in reverse
92 # Finally, clean up any directories that were created by the
94 if [ -n "${created_be_dirs}" ]; then
95 chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs}
97 ${BE_UTILITY} destroy -F ${BENAME}
106 [ -e "${BE_MNTPT}${curdir}" ] && break
112 # Add the top-most nonexistent directory to the list, then
113 # mkdir -p the innermost directory specified by the argument.
117 mkdir -p ${BE_MNTPT}${dir} || return $?
123 ${ETCUPDATE_CMD} -p -s ${srcdir} -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
124 ${ETCUPDATE_CMD} resolve -D ${BE_MNTPT} || return $?
129 ${ETCUPDATE_CMD} -s ${srcdir} ${ETCUPDATE_FLAGS} || return $?
134 # Special command-line subcommand that can be used to do a full cleanup
135 # after a manual post-mortem has been completed.
137 [ -n "${BENAME}" ] || errx "Must specify BENAME"
138 [ -n "${BE_MNTPT}" ] || errx "Must specify BE_MNTPT"
139 echo "Performing post-mortem on BE ${BENAME} at ${BE_MNTPT} ..."
142 echo "Post-mortem cleanup complete."
147 if [ -n "$BEINSTALL_CMD" ]; then
152 if [ "$(basename -- "${BE_UTILITY}")" = "bectl" ]; then
161 [ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree"
163 objdir=$(make -V .OBJDIR 2>/dev/null)
164 [ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree"
170 if [ -e .git ] ; then
171 commit_time=$(git show -s --format='%ct' 2>/dev/null)
172 [ $? -ne 0 ] && errx "Can't lookup git commit timestamp"
173 commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S')
174 elif [ -d .svn ] ; then
175 if [ -e /usr/bin/svnlite ]; then
177 elif [ -e /usr/local/bin/svn ]; then
182 …commit_ts="$( "$svn" info --show-item last-changed-date | sed -e 's/\..*//' -e 's/T/./' -e 's/-//g…
183 [ $? -ne 0 ] && errx "Can't lookup Subversion commit timestamp"
188 commit_ver=$(${objdir}/bin/freebsd-version/freebsd-version -u 2>/dev/null)
189 [ -z "${commit_ver}" ] && errx "Unable to determine FreeBSD version"
191 BENAME="${commit_ver}-${commit_ts}"
193 BE_TMP=$(mktemp -d /tmp/beinstall.XXXXXX)
194 [ $? -ne 0 -o ! -d ${BE_TMP} ] && errx "Unable to create mountpoint"
195 [ -z "$NO_CLEANUP_BE" ] && cleanup_commands="rmdir_be ${cleanup_commands}"
197 mkdir -p ${BE_MNTPT}
200 [ -z "$NO_CLEANUP_BE" ] && cleanup_commands="cleanup_be ${cleanup_commands}"
206 if [ -n "${CONFIG_UPDATER}" ]; then
208 [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (pre-world) failed!"
212 # changes applied by the pre-installworld updater. Cleanup any directories
215 mount -t nullfs "${srcdir}" "${BE_MNTPT}${srcdir}" || errx "Unable to mount src"
216 mount -t nullfs "${objdir}" "${BE_MNTPT}${objdir}" || errx "Unable to mount obj"
217 mount -t devfs devfs "${BE_MNTPT}/dev" || errx "Unable to mount devfs"
219 chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld || \
222 if [ -n "${CONFIG_UPDATER}" ]; then
224 [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (post-world) failed!"
232 if [ -z "${NO_PKG_UPGRADE}" ]; then
237 if [ -n "$NO_CLEANUP_BE" ]; then
238 echo "Boot Environment ${BENAME} may be examined in ${BE_MNTPT}."
250 echo "Boot environment ${BENAME} setup complete; reboot to use it."