From 6313049ee6df1f096a464c40f4654a23c2358502 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 15 Jul 2015 11:45:11 +0200 Subject: update.sh create_configblock.sh: improve test for awk and exit on failure On recent Ubuntu distributions gawk no longer supports awk -V which makes the test fail. Simulate our awk use case and test the result instead. Additionally set 'set -e' to exit immediately on errors. Fix places where a command returns not zero in 'normal' situations. E.g. A full disk leads otherwise to funny effects. Allow relative OUT_DIR. --- recipes/images/files/library/create_configblock.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'recipes/images/files/library/create_configblock.sh') diff --git a/recipes/images/files/library/create_configblock.sh b/recipes/images/files/library/create_configblock.sh index f21b05c..3829fbb 100755 --- a/recipes/images/files/library/create_configblock.sh +++ b/recipes/images/files/library/create_configblock.sh @@ -1,5 +1,8 @@ #! /bin/sh +# exit on error +set -e + Usage() { echo "create_configblock creates a configblock binary from the info on the module sticker." @@ -31,6 +34,10 @@ while getopts "h" Option ; do esac done +#sanity check for some programs +AWKTEST=`echo 12345678abcdefgh | awk 'BEGIN{ FIELDWIDTHS = "8 8"} {print $2}'` || true +[ "${AWKTEST}x" = "abcdefghx" ] || { echo >&2 "Program gawk not available. Aborting."; exit 1; } + # autotect MODTYPE from from rootfs directory CNT=`grep -c "T20" rootfs/etc/issue || true` if [ ${CNT} -ge 1 ] ; then -- cgit v1.2.3