I don't see any solution to my problem in the existing aricles,so guys please help

I want to automate installation so i'm using the sudo apt-get -y --force-yes install the program that i want to install reqquires to install another program which runs in ncurses and ask the user to press enter

I ve already tried the echo '\r\n' | sudo apt-get -y --force-yes install "mycommand" But it didn't work

share|improve this question
1  
Usually the dialogs that are spawned during apt operations are from underlying dpkg configure / reconfigure commands - you can replace them with a simple readline CLI by setting DEBIAN_FRONTEND=readline - then you won't need to wrangle with ncurses – steeldriver Jun 28 '17 at 13:26

Thanks, i found that the easiest way to install a package ,with script ,that need confirmation (enter pressed) from the user.

First you have to find where you will echo the true value.
Open a terminal and install the package, let's say the package that you want to install is the oracle-java8-installer

1)"sudo apt-get -y --force-yes install oracle-java8-installer" (i used force yes so it don't ask for y/n)

Find the name of the parametre that need to be set true.
2) "sudo debconf-show oracle-java8-installer" ,with this you ll see the parametres of the package . In this example the bash replies with:

shared/error-oracle-license-v1-1:
* shared/accepted-oracle-license-v1-1: true
oracle-java8-installer/local:
oracle-java8-installer/not_exist:
shared/present-oracle-license-v1-1:

From the above list we need the "shared/accepted-oracle-license-v1-1" this is the parametre that sould be true.(now it's already true because the installation is done in this machine)

3)So now that you know the parametre, in the script you'll write:
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections (for setting the value)
and
sudo apt-get -y --force-yes install oracle-java8-installer (to install)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.