From: Priya N S <priya...@ti.com> * Validate user input of rootfs tarball selection. * This will not allow the user to proceed with wrong rootfs tarball selection.
Signed-off-by: Priya N S <priya...@ti.com> Signed-off-by: Sekhar Nori <nsek...@ti.com> --- create-sdcard.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/create-sdcard.sh b/create-sdcard.sh index 264095a..d052312 100644 --- a/create-sdcard.sh +++ b/create-sdcard.sh @@ -766,10 +766,19 @@ cat << EOM ################################################################################ EOM - ls --sort=size $ROOTFILEPARTH | grep "tisdk.*image" | grep 'tar.xz' | grep -n '' | awk {'print " " , $1'} - echo "" - read -p "Enter Number of rootfs Tarball: " TARNUMBER - echo " " + COUNT=`ls $ROOTFILEPARTH | grep "tisdk.*image" | grep 'tar.xz' | grep -n '' | awk {'print $1'} | wc -l` + while : + do + ls --sort=size $ROOTFILEPARTH | grep "tisdk.*image" | grep 'tar.xz' | grep -n '' | awk {'print " " , $1'} + read -p "Enter Number of rootfs Tarball: " TARNUMBER + echo + if [ -z "${TARNUMBER//[1-$COUNT]}" ] && [ -n "$TARNUMBER" ] ; then + break + else + echo "Invalid selection: '$TARNUMBER'. Please use values from 1 to $COUNT" + fi + echo + done FOUNDTARFILENAME=`ls --sort=size $ROOTFILEPARTH | grep "image" | grep 'tar.xz' | grep -n '' | grep "${TARNUMBER}:" | cut -c3- | awk {'print$1'}` ROOTFSTAR=$FOUNDTARFILENAME -- 2.19.1.windows.1 _______________________________________________ meta-arago mailing list meta-arago@arago-project.org http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago