I would like to configure ubuntu package via dpkg-reconfigure with all the values supplied via non-interactive mode (in the script).
In fact my case is firebird confiiguration (http://www.firebirdsql.org/manual/ubusetup.html), that when using command:
sudo dpkg-reconfigure firebird2.5-superclassic -freadline
asks me for the 2 values, where answers would be 'Y' and 'newpwd' .
Sample output looks like this:
sudo dpkg-reconfigure firebird2.5-superclassic -freadline
* Firebird 2.5 superclassic server not running
Configuring firebird2.5-superclassic
------------------------------------
Accept if you want Firebird server to start automatically.
If you only need the Firebird client and there are no databases that will be served by this host, decline.
Enable Firebird server? Y
Password for firebird 2.5
-------------------------
Firebird has a special user named SYSDBA, which is the user that has access to all databases. SYSDBA can also create new databases and users. Because of this, it
is necessary to secure SYSDBA with a password.
The password is stored in /etc/firebird/2.5/SYSDBA.password (readable only by root). You may modify it there (don't forget to update the security database too,
using the gsec utility), or you may use dpkg-reconfigure to update both.
To keep your existing password, leave this blank.
Password for SYSDBA:
* Starting Firebird 2.5 superclassic server...
...done.
* Firebird 2.5 superclassic server already running
I've tried here strings
via bash script like this:
sudo dpkg-reconfigure firebird2.5-superclassic -f readline << EOF
Y
newpwd
EOF
However this didn't work for some reason and it asked for the values to be supplied.
Any ideas how to feed the required values to script?
/var/cache/debconf/config.dat
yourself. You can usedebconf-get-selections
from thedebconf-utils
package. See this for example. – Joseph R. Oct 16 '13 at 00:43dpkg-reconfigure
, which I'm guessing the OP wants to automate because he'll be doing it frequently. – Joseph R. Oct 16 '13 at 02:19debconf-get-selections
is likely to be useful here. If Peter wants to do this often with different values, he should generate aconfig.dat
dynamically (it's a simple format). This is easier thanexpect
.expect
is the path of desperation. For example, it'll break down if a new version of the package introduces a new question (or else you need a far more sophisticated script). – Gilles 'SO- stop being evil' Oct 16 '13 at 17:52