From: Masami Hiramatsu (Google) Date: Thu, 10 Jul 2025 02:24:02 +0000 (+0900) Subject: tools/bootconfig: Improve portability X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfed3dd2a1974896cb75556ac3af71c1c391cec4;p=thirdparty%2Fkernel%2Flinux.git tools/bootconfig: Improve portability Since 'stat' command and 'truncate' command are GNU extension, use 'wc' and 'dd' commands instead. Link: https://lore.kernel.org/all/175211424184.2591046.3523297993175066026.stgit@mhiramat.tok.corp.google.com/ Signed-off-by: Masami Hiramatsu (Google) --- diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh index 32401bf613409..aea302bd7c2a1 100755 --- a/tools/bootconfig/test-bootconfig.sh +++ b/tools/bootconfig/test-bootconfig.sh @@ -49,12 +49,12 @@ xpass $BOOTCONF -d $INITRD dd if=/dev/zero of=$INITRD bs=4096 count=1 echo "key = value;" > $TEMPCONF -bconf_size=$(stat -c %s $TEMPCONF) -initrd_size=$(stat -c %s $INITRD) +bconf_size=$(wc -c < $TEMPCONF) +initrd_size=$(wc -c < $INITRD) echo "Apply command test" xpass $BOOTCONF -a $TEMPCONF $INITRD -new_size=$(stat -c %s $INITRD) +new_size=$(wc -c < $INITRD) echo "Show command test" xpass $BOOTCONF $INITRD @@ -69,13 +69,13 @@ echo "Apply command repeat test" xpass $BOOTCONF -a $TEMPCONF $INITRD echo "File size check" -xpass test $new_size -eq $(stat -c %s $INITRD) +xpass test $new_size -eq $(wc -c < $INITRD) echo "Delete command check" xpass $BOOTCONF -d $INITRD echo "File size check" -new_size=$(stat -c %s $INITRD) +new_size=$(wc -c < $INITRD) xpass test $new_size -eq $initrd_size echo "No error messge while applying" @@ -108,7 +108,8 @@ dd if=/dev/urandom bs=768 count=32 | base64 -w0 >> $TEMPCONF echo "\"" >> $TEMPCONF xfail $BOOTCONF -a $TEMPCONF $INITRD -truncate -s 32764 $TEMPCONF +dd if=$TEMPCONF of=$OUTFILE bs=1 count=32764 +cp $OUTFILE $TEMPCONF echo "\"" >> $TEMPCONF # add 2 bytes + terminal ('\"\n\0') xpass $BOOTCONF -a $TEMPCONF $INITRD