mkisoimages.sh: Avoid creating temporary files in the current directory

Currently the current directory is the parent of the rootfs directory,
but this will change in order to support NO_ROOT builds that use a
metalog manifest, since those need to have the current directory be the
rootfs itself in order for the relative paths to be correct, and we do
not want the non-METALOG case (which passes the directory to makefs) to
pick up leftover temporary .img files from a previous failed build.

Reviewed by:	brooks, emaste, gjb
Differential Revision:	https://reviews.freebsd.org/D33998
This commit is contained in:
Jessica Clarke 2022-02-28 22:36:51 +00:00
parent b58ea3e1f7
commit 045c8f5264
3 changed files with 12 additions and 9 deletions

View File

@ -85,15 +85,16 @@ if [ "$bootable" != "" ]; then
done
# Create a GPT image containing the partitions we need for hybrid boot.
hybridfilename=$(mktemp /tmp/hybrid.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
$MKIMG -s gpt \
--capacity $imgsize \
-b "$BASEBITSDIR/boot/pmbr" \
-p freebsd-boot:="$BASEBITSDIR/boot/isoboot" \
$espparam \
-o hybrid.img
-o $hybridfilename
# Drop the PMBR, GPT, and boot code into the System Area of the ISO.
dd if=hybrid.img of="$NAME" bs=32k count=1 conv=notrunc
rm -f hybrid.img
dd if=$hybridfilename of="$NAME" bs=32k count=1 conv=notrunc
rm -f $hybridfilename
fi

View File

@ -81,13 +81,14 @@ if [ "$bootable" != "" ]; then
done
# Create a GPT image containing the EFI partition.
efifilename=$(mktemp /tmp/efi.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
$MKIMG -s gpt \
--capacity $imgsize \
$espparam \
-o efi.img
-o $efifilename
# Drop the GPT into the System Area of the ISO.
dd if=efi.img of="$NAME" bs=32k count=1 conv=notrunc
rm -f efi.img
dd if=$efifilename of="$NAME" bs=32k count=1 conv=notrunc
rm -f $efifilename
fi

View File

@ -81,13 +81,14 @@ if [ "$bootable" != "" ]; then
done
# Create a GPT image containing the EFI partition.
efifilename=$(mktemp /tmp/efi.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
$MKIMG -s gpt \
--capacity $imgsize \
$espparam \
-o efi.img
-o $efifilename
# Drop the GPT into the System Area of the ISO.
dd if=efi.img of="$NAME" bs=32k count=1 conv=notrunc
rm -f efi.img
dd if=$efifilename of="$NAME" bs=32k count=1 conv=notrunc
rm -f $efifilename
fi