I'd like to know in common how to use the results of debconf-show with debconf set selections to precvonfigure deb packages with the command line or within a shell script
For example
If I use
sudo debconf-get-selections | grep java7 > result;cat resultI get the following
oracle-java7-installer shared/present-oracle-license-v1-1 note
oracle-java7-installer oracle-java7-installer/local string
oracle-java7-installer shared/accepted-oracle-license-v1-1 boolean true
oracle-java7-installer shared/error-oracle-license-v1-1 error
oracle-java7-installer oracle-java7-installer/not_exist errorHow would the right debconf set selections line look like to configure the two dialoges that appear trough the installation?
In general how is the right syntax of debconf set selections I assume there are not only booleans like true or false and yes or no
I guess there is much more an other example will be how to select the default desktop manager if lightdm and gdm installed by a bash script.
Is there a general proofed approach to determine and the right values for a debconf package and write a proper bash script that installs something like the webupt8 java package and preselect the values that the user normally would be asked for?
2 Answers
You need to use pre-seeding.
The debconf-set-selections command presets answers asked by debconf before installing the package.
E.G.
sudo debconf-set-selections <<< "shared/accepted-oracle-license-v1-1 boolean true"Then install the package.
sudo apt-get install -y oracle-java7-installer 1 Debconf accepts only a restricted set of possible type values, for instance, boolean, string, note, select, and others, and it's very peaky about it.
In your question, I assume you want to automate the Java license debconf value, so you may run something like this:
echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 boolean true" | sudo debconf-set-selectionsIf you need to add a string value, run something like this:
echo "oracle-java7-installer oracle-java7-installer/local string java" | sudo debconf-set-selectionsIf you need a select value you may run:
echo "oracle-java7-installer oracle-java7-installer/legacy select true" | sudo debconf-set-selectionsNOTE: after running these commands ensure the right values are set with something like
sudo debconf-show oracle-java7-installerand then, of course, test it on a real server installation.
TIP: Instead of
> result;cat resultyou may just use| tee resultit works very similar but does not wait until the first command completes to show you the content