From c474f5a9fcfc8eaf8022d58d199ed8af1bc65521 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 19 Apr 2016 14:33:20 -0700 Subject: 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 Signed-off-by: Marcel Ziswiler --- recipes/images/files/library/tegra/update.sh | 16 +++++++--------- 1 file 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 -- cgit v1.2.3