release: Support GNU stat in mkisoimages.sh

BSD stat and GNU stat differ significantly when it comes to using a
custom format string, both in the option name and in the format string
itself. Handle both here (assuming Linux means GNU stat rather than BSD
stat).

Reviewed by:	brooks, gjb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35814
This commit is contained in:
Jessica Clarke 2022-07-15 23:04:48 +01:00
parent fcf1208158
commit cefe58791b
3 changed files with 15 additions and 3 deletions

View File

@ -112,7 +112,11 @@ if [ "$bootable" != "" ]; then
# Create a GPT image containing the partitions we need for hybrid boot.
hybridfilename=$(mktemp /tmp/hybrid.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
if [ "$(uname -s)" = "Linux" ]; then
imgsize=`stat -c %s "$NAME"`
else
imgsize=`stat -f %z "$NAME"`
fi
$MKIMG -s gpt \
--capacity $imgsize \
-b "$BASEBITSDIR/boot/pmbr" \

View File

@ -107,7 +107,11 @@ if [ "$bootable" != "" ]; then
# Create a GPT image containing the EFI partition.
efifilename=$(mktemp /tmp/efi.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
if [ "$(uname -s)" = "Linux" ]; then
imgsize=`stat -c %s "$NAME"`
else
imgsize=`stat -f %z "$NAME"`
fi
$MKIMG -s gpt \
--capacity $imgsize \
$espparam \

View File

@ -107,7 +107,11 @@ if [ "$bootable" != "" ]; then
# Create a GPT image containing the EFI partition.
efifilename=$(mktemp /tmp/efi.img.XXXXXX)
imgsize=`stat -f %z "$NAME"`
if [ "$(uname -s)" = "Linux" ]; then
imgsize=`stat -c %s "$NAME"`
else
imgsize=`stat -f %z "$NAME"`
fi
$MKIMG -s gpt \
--capacity $imgsize \
$espparam \