release: Consistently use variables for invoking certain tools

This change cleans up the inconsistent ways of invoking makefs and mkimg
by making sure that these tools are invoked through their corresponding
variables. This was previously only used in a few amd64 and arm64 release
scripts.

Sponsored by:   Klara, Inc.
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51039
Reviewed by:	emaste, markj
This commit is contained in:
Bojan Novković 2025-06-24 17:17:36 +02:00
parent ceab09e3db
commit 483ef23ebb
10 changed files with 31 additions and 51 deletions

View file

@ -12,6 +12,7 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ "$(uname -s)" = "FreeBSD" ]; then
@ -51,7 +52,7 @@ if [ -n "${METALOG}" ]; then
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
MAKEFSARG=${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
${MAKEFS} -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
rm ${BASEBITSDIR}/etc/fstab
rm ${BASEBITSDIR}/etc/rc.conf.local
if [ -n "${METALOG}" ]; then
@ -67,10 +68,10 @@ else
make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi
fi
mkimg -s mbr \
${MKIMG} -s mbr \
-b ${BASEBITSDIR}/boot/mbr \
-p efi:=${espfilename} \
-p freebsd:-"mkimg -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \
-p freebsd:-"${MKIMG} -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \
-a 2 \
-o ${2}
rm ${espfilename}

View file

@ -25,20 +25,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ -z $ETDUMP ]; then
ETDUMP=etdump
fi
if [ -z $MAKEFS ]; then
MAKEFS=makefs
fi
if [ -z $MKIMG ]; then
MKIMG=mkimg
fi
if [ "$1" = "-b" ]; then
MAKEFSARG="$4"
else

View file

@ -17,6 +17,7 @@ if [ "$(uname -s)" = "FreeBSD" ]; then
fi
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ $# -ne 2 ]; then
@ -51,7 +52,7 @@ if [ -n "${METALOG}" ]; then
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
MAKEFSARG=${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
${MAKEFS} -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
rm ${BASEBITSDIR}/etc/fstab
rm ${BASEBITSDIR}/etc/rc.conf.local
if [ -n "${METALOG}" ]; then
@ -62,7 +63,7 @@ fi
espfilename=$(mktemp /tmp/efiboot.XXXXXX)
make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi
mkimg -s gpt \
${MKIMG} -s gpt \
-p efi:=${espfilename} \
-p freebsd-ufs:=${2}.part \
-o ${2}

View file

@ -21,20 +21,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ -z $ETDUMP ]; then
ETDUMP=etdump
fi
if [ -z $MAKEFS ]; then
MAKEFS=makefs
fi
if [ -z $MKIMG ]; then
MKIMG=mkimg
fi
if [ "$1" = "-b" ]; then
MAKEFSARG="$4"
else

View file

@ -11,6 +11,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
if [ "$(uname -s)" = "FreeBSD" ]; then
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
@ -48,16 +51,16 @@ if [ -n "${METALOG}" ]; then
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
MAKEFSARG=${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
${MAKEFS} -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
rm ${BASEBITSDIR}/etc/fstab
rm ${BASEBITSDIR}/etc/rc.conf.local
if [ -n "${METALOG}" ]; then
rm ${metalogfilename}
fi
mkimg -s mbr \
${MKIMG} -s mbr \
-b ${BASEBITSDIR}/boot/mbr \
-p freebsd:-"mkimg -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \
-p freebsd:-"${MKIMG} -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \
-o ${2}
rm ${2}.part

View file

@ -24,6 +24,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
if [ "$1" = "-b" ]; then
MAKEFSARG="$4"
else
@ -67,7 +70,7 @@ if [ -n "${METALOG}" ]; then
echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
MAKEFSARG=${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@"
${MAKEFS} -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@"
rm -f "$BASEBITSDIR/etc/fstab"
if [ -n "${METALOG}" ]; then
rm ${metalogfilename}

View file

@ -24,6 +24,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
if [ "$1" = "-b" ]; then
MAKEFSARG="$4"
else
@ -107,7 +110,7 @@ echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab"
if [ -n "${METALOG}" ]; then
echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@"
${MAKEFS} -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@"
rm -f "$BASEBITSDIR/etc/fstab"
if [ n "$bootable" ]; then
rm $BOOTBLOCK

View file

@ -17,6 +17,7 @@ if [ "$(uname -s)" = "FreeBSD" ]; then
fi
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ $# -ne 2 ]; then
@ -51,7 +52,7 @@ if [ -n "${METALOG}" ]; then
echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename}
MAKEFSARG=${metalogfilename}
fi
makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
${MAKEFS} -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG}
rm ${BASEBITSDIR}/etc/fstab
rm ${BASEBITSDIR}/etc/rc.conf.local
if [ -n "${METALOG}" ]; then
@ -62,7 +63,7 @@ fi
espfilename=$(mktemp /tmp/efiboot.XXXXXX)
make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi
mkimg -s gpt \
${MKIMG} -s gpt \
-p efi:=${espfilename} \
-p freebsd-ufs:=${2}.part \
-o ${2}

View file

@ -21,20 +21,9 @@
set -e
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
if [ -z $ETDUMP ]; then
ETDUMP=etdump
fi
if [ -z $MAKEFS ]; then
MAKEFS=makefs
fi
if [ -z $MKIMG ]; then
MKIMG=mkimg
fi
if [ "$1" = "-b" ]; then
MAKEFSARG="$4"
else

View file

@ -6,6 +6,7 @@
#
scriptdir=$(dirname $(realpath $0))
. ${scriptdir}/../scripts/tools.subr
. ${scriptdir}/../../tools/boot/install-boot.sh
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
@ -209,11 +210,11 @@ buildfs() {
case "${VMFS}" in
ufs)
cd ${DESTDIR} && makefs ${MAKEFSARGS} -o label=rootfs -o version=2 -o softupdates=1 \
cd ${DESTDIR} && ${MAKEFS} ${MAKEFSARGS} -o label=rootfs -o version=2 -o softupdates=1 \
${VMBASE} .${NO_ROOT:+/METALOG}
;;
zfs)
cd ${DESTDIR} && makefs -t zfs ${MAKEFSARGS} \
cd ${DESTDIR} && ${MAKEFS} -t zfs ${MAKEFSARGS} \
-o poolname=zroot -o bootfs=zroot/ROOT/default -o rootpath=/ \
-o fs=zroot\;mountpoint=none \
-o fs=zroot/ROOT\;mountpoint=none \
@ -342,7 +343,7 @@ vm_create_disk() {
buildfs
echo "Building final disk image... Please wait."
mkimg -s ${PARTSCHEME} -f ${VMFORMAT} \
${MKIMG} -s ${PARTSCHEME} -f ${VMFORMAT} \
${BOOTPARTS} \
${SWAPOPT} \
${CONFIG_DRIVE} \