mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-23 18:14:56 +01:00
Merge the following from ^/projects/release-vmimage:
r272436, r272437, r272792: r272436: Remove the first argument to panic(), which was initially intended to be the exit code, however when a non-zero exit code was returned to release/Makefile, this would prevent any remaining (and possibly successful) stages from being attempted. r272437: If the vm-base target fails, prevent the vm-image target from being run since it cannot possibly succeed. r272792: Add /usr/local/bin and /usr/local/sbin to PATH, needed if third-party software needs to use utilities outside of the base system during post-install stages (indexinfo is one culprit). MFC after: 3 days X-MFC-10.1: yes Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
7f4b9af631
commit
7cb62648d9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273093
@ -32,7 +32,7 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
export PATH
|
||||
|
||||
usage_vm_base() {
|
||||
@ -58,16 +58,25 @@ usage() {
|
||||
}
|
||||
|
||||
panic() {
|
||||
rc="${1}"
|
||||
shift 1
|
||||
msg="${@}"
|
||||
printf "${msg}\n"
|
||||
if [ ! -z "${mddev}" ]; then
|
||||
mdconfig -d -u ${mddev}
|
||||
fi
|
||||
case ${cmd} in
|
||||
vm-base)
|
||||
# If the vm-base target fails, the vm-image target
|
||||
# cannot possibly succeed. Touch the .TARGET file
|
||||
# so it is not attempted.
|
||||
touch vm-image
|
||||
;;
|
||||
*)
|
||||
# FALLTHROUGH
|
||||
;;
|
||||
esac
|
||||
# Do not allow one failure case to chain through any remaining image
|
||||
# builds.
|
||||
exit 0
|
||||
return 1
|
||||
}
|
||||
|
||||
vm_create_baseimage() {
|
||||
@ -96,7 +105,7 @@ vm_create_baseimage() {
|
||||
cd ${WORLDDIR} && \
|
||||
make DESTDIR=${DESTDIR} \
|
||||
installworld installkernel distribution || \
|
||||
panic 1 "\n\nCannot install the base system to ${DESTDIR}."
|
||||
panic "\n\nCannot install the base system to ${DESTDIR}."
|
||||
chroot ${DESTDIR} /usr/bin/newaliases
|
||||
echo '# Custom /etc/fstab for FreeBSD VM images' \
|
||||
> ${DESTDIR}/etc/fstab
|
||||
@ -111,7 +120,7 @@ vm_create_baseimage() {
|
||||
# This should never happen. But, it has happened.
|
||||
msg="Cannot umount(8) ${DESTDIR}\n"
|
||||
msg="${msg}Something has gone horribly wrong."
|
||||
panic 1 "${msg}"
|
||||
panic "${msg}"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
@ -141,11 +150,11 @@ vm_create_vmdisk() {
|
||||
if [ -z "${mkimg_version}" ]; then
|
||||
msg="Cannot determine mkimg(1) version.\n"
|
||||
msg="${msg}Cannot continue without a known mkimg(1) version."
|
||||
panic 0 "${msg}"
|
||||
panic "${msg}"
|
||||
fi
|
||||
|
||||
if ! mkimg --formats 2>/dev/null | grep -q ${FORMAT}; then
|
||||
panic 0 "'${FORMAT}' is not supported by this mkimg(1).\n"
|
||||
panic "'${FORMAT}' is not supported by this mkimg(1).\n"
|
||||
fi
|
||||
|
||||
case ${FORMAT} in
|
||||
|
@ -32,7 +32,7 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
||||
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
export PATH
|
||||
|
||||
usage_vm_base() {
|
||||
@ -58,16 +58,25 @@ usage() {
|
||||
}
|
||||
|
||||
panic() {
|
||||
rc="${1}"
|
||||
shift 1
|
||||
msg="${@}"
|
||||
printf "${msg}\n"
|
||||
if [ ! -z "${mddev}" ]; then
|
||||
mdconfig -d -u ${mddev}
|
||||
fi
|
||||
case ${cmd} in
|
||||
vm-base)
|
||||
# If the vm-base target fails, the vm-image target
|
||||
# cannot possibly succeed. Touch the .TARGET file
|
||||
# so it is not attempted.
|
||||
touch vm-image
|
||||
;;
|
||||
*)
|
||||
# FALLTHROUGH
|
||||
;;
|
||||
esac
|
||||
# Do not allow one failure case to chain through any remaining image
|
||||
# builds.
|
||||
exit 0
|
||||
return 1
|
||||
}
|
||||
|
||||
vm_create_baseimage() {
|
||||
@ -96,7 +105,7 @@ vm_create_baseimage() {
|
||||
cd ${WORLDDIR} && \
|
||||
make DESTDIR=${DESTDIR} \
|
||||
installworld installkernel distribution || \
|
||||
panic 1 "\n\nCannot install the base system to ${DESTDIR}."
|
||||
panic "\n\nCannot install the base system to ${DESTDIR}."
|
||||
chroot ${DESTDIR} /usr/bin/newaliases
|
||||
echo '# Custom /etc/fstab for FreeBSD VM images' \
|
||||
> ${DESTDIR}/etc/fstab
|
||||
@ -111,7 +120,7 @@ vm_create_baseimage() {
|
||||
# This should never happen. But, it has happened.
|
||||
msg="Cannot umount(8) ${DESTDIR}\n"
|
||||
msg="${msg}Something has gone horribly wrong."
|
||||
panic 1 "${msg}"
|
||||
panic "${msg}"
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
@ -141,11 +150,11 @@ vm_create_vmdisk() {
|
||||
if [ -z "${mkimg_version}" ]; then
|
||||
msg="Cannot determine mkimg(1) version.\n"
|
||||
msg="${msg}Cannot continue without a known mkimg(1) version."
|
||||
panic 0 "${msg}"
|
||||
panic "${msg}"
|
||||
fi
|
||||
|
||||
if ! mkimg --formats 2>/dev/null | grep -q ${FORMAT}; then
|
||||
panic 0 "'${FORMAT}' is not supported by this mkimg(1).\n"
|
||||
panic "'${FORMAT}' is not supported by this mkimg(1).\n"
|
||||
fi
|
||||
|
||||
case ${FORMAT} in
|
||||
|
Loading…
Reference in New Issue
Block a user