[openwrt/openwrt] scripts/mkits.sh: fix portability issue

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 9 11:45:18 PST 2022


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b8bf27e4cb2d4c6ff4c75274c0e1d1619eef7f10

commit b8bf27e4cb2d4c6ff4c75274c0e1d1619eef7f10
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Sat Oct 29 19:01:48 2022 +0200

    scripts/mkits.sh: fix portability issue
    
    BSD wc can output more whitespaces, which breaks the cut usage.
    Replace the cut invocation with awk, which is more portable.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 scripts/mkits.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 58c879cd62..bf75d69f09 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -89,7 +89,7 @@ if [ -n "${COMPATIBLE}" ]; then
 fi
 
 [ "$DTOVERLAY" ] && {
-	dtbsize=$(wc -c "$DTB" | cut -d' ' -f1)
+	dtbsize=$(wc -c "$DTB" | awk '{print $1}')
 	DTADDR=$(printf "0x%08x" $(($LOAD_ADDR - $dtbsize)) )
 }
 
@@ -168,7 +168,7 @@ OVCONFIGS=""
 	overlay_blob=${overlay##*:}
 	ovname=${overlay%%:*}
 	ovnode="fdt-$ovname"
-	ovsize=$(wc -c "$overlay_blob" | cut -d' ' -f1)
+	ovsize=$(wc -c "$overlay_blob" | awk '{print $1}')
 	echo "$ovname ($overlay_blob) : $ovsize" >&2
 	DTADDR=$(printf "0x%08x" $(($DTADDR - $ovsize)))
 	FDTOVERLAY_NODE="$FDTOVERLAY_NODE




More information about the lede-commits mailing list