All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Priya N S <priya.ns@mistralsolutions.com>
Cc: meta-arago@arago-project.org, Priya N S <priya.ns@ti.com>,
	Sekhar Nori <nsekhar@ti.com>
Subject: Re: [tisdk-setup-scripts] [master] [PATCH-V2 2/3] create-sdcard: Fix wrong rootfs tarball selection
Date: Tue, 22 Jun 2021 22:19:02 -0500	[thread overview]
Message-ID: <20210623031902.ngujfnp4iqwv2iz3@turkey> (raw)
In-Reply-To: <20210622134500.87848-3-priya.ns@mistralsolutions.com>

On 19:14-20210622, Priya N S wrote:
> From: Priya N S <priya.ns@ti.com>
> 
> From: Priya N S <priya.ns@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.ns@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>  create-sdcard.sh | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/create-sdcard.sh b/create-sdcard.sh
> index 264095a..8f99687 100644
> --- a/create-sdcard.sh
> +++ b/create-sdcard.sh
> @@ -767,9 +767,19 @@ cat << EOM
>  
>  EOM
>  		ls --sort=size $ROOTFILEPARTH | grep "tisdk.*image" | grep 'tar.xz' | grep -n '' | awk {'print "	" , $1'}

Do you want to move this inside the while loop?

> -		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`
> +		ENTERCORRECTLY="0"
> +		while [ $ENTERCORRECTLY -ne 1 ]
> +		do
> +			read -p "Enter Number of rootfs Tarball: " TARNUMBER
> +			echo " "

just echo?

> +			if [ -z "${TARNUMBER//[0-$COUNT]}" ] && [ -n "$TARNUMBER" ] ; then

if COUNT=2 is '0' a valid entry? While the above might be a smart code,
I wonder if we could simplify for readability?


> +				ENTERCORRECTLY=1
'break' should simplify this loop?
> +			else
> +				echo "Invalid selection!"
Could we articulate this to be "Invalid selection: '$TARNUMBER'. Please use values from 1 to $COUNT"
> +			fi
> +			echo ""
"" is redundant.

I don't think the following is proper - does'nt handle 0 case, but..
maybe?
while :
do
	read -p "Enter Number of rootfs Tarball: " TARNUMBER
	echo
	if [ -z "${TARNUMBER//[0-$COUNT]}" ] && [ -n "$TARNUMBER" ] ; then
		break
	fi
	echo "Invalid selection: '$TARNUMBER'. Please use values from 1 to $COUNT"
done
> +		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

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D


  reply	other threads:[~2021-06-23  3:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 13:44 [tisdk-setup-scripts] [master] [PATCH-V2 0/3] create-sdcard: Fix rootfs tarball search and selection Priya N S
2021-06-22 13:44 ` [tisdk-setup-scripts] [master] [PATCH-V2 1/3] create-sdcard.sh: fix regex used for rootfs tarball Priya N S
2021-06-23  3:03   ` Nishanth Menon
2021-07-07  2:38     ` Vigna Raja Priya N S
2021-06-22 13:44 ` [tisdk-setup-scripts] [master] [PATCH-V2 2/3] create-sdcard: Fix wrong rootfs tarball selection Priya N S
2021-06-23  3:19   ` Nishanth Menon [this message]
2021-07-07  2:35     ` Vigna Raja Priya N S
2021-06-22 13:45 ` [tisdk-setup-scripts] [master] [PATCH-V2 3/3] create-sdcard.sh: Stop using cylinder as unit for partition size Priya N S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210623031902.ngujfnp4iqwv2iz3@turkey \
    --to=nm@ti.com \
    --cc=meta-arago@arago-project.org \
    --cc=nsekhar@ti.com \
    --cc=priya.ns@mistralsolutions.com \
    --cc=priya.ns@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.