Skip to content

Commit

Permalink
scripts/mkits.sh: fix portability issue
Browse files Browse the repository at this point in the history
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@nbd.name>
  • Loading branch information
nbd168 committed Nov 9, 2022
1 parent 94d0cb9 commit b8bf27e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/mkits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)) )
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b8bf27e

Please sign in to comment.