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)
DEBIAN_FRONTEND=readline- then you won't need to wrangle with ncurses – steeldriver Jun 28 '17 at 13:26