3

I am developing a specialized Unix application that has the Debian installer (.deb). It needs to get few simple string values during installation. These values must be picked by the post-install bash script.

What would be most reasonable, approved way top pass these values to the post install script?

3

The “approved” way to do this is to use debconf. This might seem surprising if you’re not interested in actually prompting the user for the information; but beyond prompting, debconf is based on the notion of package configuration variables, and prompting is only one of the ways that can be used to provide the values for those variables. The debconf-devel manpage describes how to use this.

In your case, you’d declare the variables in your package’s templates and config script, and then use them in your postinst. To feed the values in without prompting, you’d then use pre-seeding:

  • write a file containing the keys and values:

    <package> <config key> <config type> <value>
    ...
    
  • before installing the package, store its configuration:

    debconf-set-selections < preseed-file
    

See Automating the installation of individual debian 8 packages with interactive prompts for an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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