diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2016-04-19 14:33:20 -0700 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-06-24 00:48:42 +0200 |
commit | c474f5a9fcfc8eaf8022d58d199ed8af1bc65521 (patch) | |
tree | e409c151740e999844d16e2ac04a2b7ea1168e29 /recipes/images/files | |
parent | 885240934ecdfa7f4b13a80a1ac63b63f60eb875 (diff) |
update.sh: use test expressions in if statement for colibri-t20
Since we introduced set -e commands which fail will exit silently.
This leads to no error message when the grep which tests for
specified parameters failed.
We could solve it with || true, but it seems more lightweight to
just test for the strings inside the if statement. It also checks
for the full length (e.g. disallows "25" as RAM size).
The later fixed only 256 MB RAM size copy paste issue.
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'recipes/images/files')
-rwxr-xr-x | recipes/images/files/library/tegra/update.sh | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/recipes/images/files/library/tegra/update.sh b/recipes/images/files/library/tegra/update.sh index 76e7c6c..5b080ca 100755 --- a/recipes/images/files/library/tegra/update.sh +++ b/recipes/images/files/library/tegra/update.sh @@ -201,22 +201,20 @@ if [ "$UBOOT_RECOVERY" -eq 1 ] ; then if [ "${MODTYPE}" = "colibri-t20" ] ; then #some sanity test, we really need RAM_SIZE and MODVERSION set echo "" - echo "256, 512" | grep -q ${RAM_SIZE} - if [ $? -eq 1 ] ; then + SANITY_CHECK=1 + if [ "256" != ${RAM_SIZE} ] && [ "512" != ${RAM_SIZE} ]; then printf "\033[1mplease specify your RAM size with the -r parameter\033[0m\n" + SANITY_CHECK=0 fi - echo "v11, v12" | grep -q ${MODVERSION} - if [ $? -eq 1 ] ; then + if [ "v11" != ${MODVERSION} ] && [ "v12" != ${MODVERSION} ]; then printf "\033[1mplease specify your module version with the -v parameter\033[0m\n" - Usage - exit 0 + SANITY_CHECK=0 fi - echo "256, 512" | grep -q ${RAM_SIZE} - if [ $? -eq 1 ] ; then + if [ ${SANITY_CHECK} -eq 0 ] ; then Usage - exit 0 + exit 1 fi fi |