2

I use a certain piece of sofware (Asterisk) which includes in its source tree a nifty little script to automatically download and install all packages it needs from your distro's repositories, including of course Ubuntu. One of these prerequisites (libvpb1) requires a piece of information (the default country phone prefix), so the script becomes not so automatic:

Installing libvpb1

It's innocuous to have this library installed in a system that doesn't run telephony stuff, so you can test it yourself.

My question is: How do I feed the answer non-interactively beforehand so apt-get install (or, rather, dpkg -i) grabs that and uses it as if it had been typed in that ncurses screen?

A generic solution would be better, like, how do I know if any package requires information like this, and how do I set it from a script?

JCCyC
  • 339

1 Answers1

4

Question linked in comment by @user535733 had the answer; I'll try to generalize the procedure here.

First, install the package interactively and feed the values you need;

Second, run this:

root@myhost:~# PACKAGE_NAME=libvpb1
root@myhost:~# debconf-get-selections | grep "^${PACKAGE_NAME}[[:blank:]]"
libvpb1 libvpb1/countrycode     string  55
root@myhost:~#

Next time you have to install the package, just feed the output from that to debconf-get-selections beforehand:

root@myhost:~# echo 'libvpb1 libvpb1/countrycode string 55' | sudo debconf-set-selections -v
root@myhost:~# apt-get -y install libvpb1

In Ubuntu 20.04, debconf-get-selections is in the debconf-utils package.

JCCyC
  • 339