summaryrefslogtreecommitdiff
path: root/recipes/images/files/library/create_configblock.sh
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-07-15 11:45:11 +0200
committerMax Krummenacher <max.oss.09@gmail.com>2015-10-12 15:15:41 +0200
commite9ad3d9002273b141953ad7bfa402f13d79042fa (patch)
treebcd26bdf1622d4c356acff8f02fedc763b044dfe /recipes/images/files/library/create_configblock.sh
parentfcb29c42d1ad3cfb76752d83642a482e3871504a (diff)
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.
Diffstat (limited to 'recipes/images/files/library/create_configblock.sh')
-rwxr-xr-xrecipes/images/files/library/create_configblock.sh7
1 files changed, 7 insertions, 0 deletions
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