[PATCH 07/12] android-wrapper: Auto accept android sdk license

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Feb 6 11:57:39 PST 2017


On Mon, 6 Feb 2017, Anton Lundin wrote:
> On 06 February, 2017 - Cristian Ionescu-Idbohrn wrote:
> > On Mon, 6 Feb 2017, Anton Lundin wrote:
> > > On 06 February, 2017 - Cristian Ionescu-Idbohrn wrote:
> > > > On Mon, 6 Feb 2017, Anton Lundin wrote:
> > > > > 
> > > > > Signed-off-by: Anton Lundin <glance at acc.umu.se>
> > > > > ---
> > > > >  packaging/android/android-build-wrapper.sh | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/packaging/android/android-build-wrapper.sh b/packaging/android/android-build-wrapper.sh
> > > > > index c8dd1e1..6242809 100644
> > > > > --- a/packaging/android/android-build-wrapper.sh
> > > > > +++ b/packaging/android/android-build-wrapper.sh
> > > > > @@ -82,7 +82,7 @@ if [ ! -d $ANDROID_SDK ] ; then
> > > > >  	mkdir $ANDROID_SDK
> > > > >  	pushd $ANDROID_SDK
> > > > >  	unzip -q ../$SDK_TOOLS
> > > > > -	bash tools/android update sdk --no-ui -a -t 1,2,3,33
> > > > > +	( sleep 5 && while true ; do sleep 1; echo y; done ) | bash tools/android update sdk --no-ui -a -t 1,2,3,33
> > > > 
> > > > Can it be so that the simplier:
> > > > 
> > > > 	yes y | bash tools/android update sdk --no-ui -a -t 1,2,3,33
> > > > 
> > > > is all you need?
> > > 
> > > Nope. sdk updater does read(0, dest, 1024) or something, so if yes have
> > > pushed too many y\n into the buffer, it will fail when doing
> > > strcmp(dest, "y\n") or something alike.
> > > 
> > > Thats why odd one here.
> > 
> > I guess you've tested `yes', that's why you know ;)
> 
> Yep =)

Weird.  I'll do that too...  Example script: /tmp/yes.sh:

---8<---
#!/bin/bash

set -eu

i=0
while read in && [ $i -lt 10 ]; do
        i=$(($i + 1))
        echo $i: $in
done
--->8---

Run with:

	$ yes | /tmp/yes.sh;echo $?

output:

1: y
2: y
3: y
4: y
5: y
6: y
7: y
8: y
9: y
10: y
0

Exactly what's expected.  What kind of beast is that `sdk updater' 
anyway?  As I read the code:

	bash tools/android update sdk --no-ui -a -t 1,2,3,33

it's a bash script.  What OS (+bash version) are you on?


Cheers,

-- 
Cristian


More information about the subsurface mailing list