dezzinto
dezzinto

Reputation: 467

How accept yes/no dialog in cli?

i want to auto accept agreement dialog - when installing android-sdk components in docker.

This is the part of my dockerfile - this section should install additional packages for android-sdk, but it does not work.

RUN echo y | ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter "${ANDROID_SDK_COMPONENTS}"

Please advice - how i can accept agreement by default. Thank you

Upvotes: 0

Views: 148

Answers (1)

SLePort
SLePort

Reputation: 15461

Try yes command :

yes | ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter "${ANDROID_SDK_COMPONENTS}"

Update :

It should work if you add a timeout before echoing y :

while true; do echo "y"; sleep 1;done | ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter "${ANDROID_SDK_COMPONENTS}"

Upvotes: 1

Related Questions