When creating a DEB package, how can I pass command line arguments to the postinst
script? I'd like to read settings from an external file and pass those as arguments.
Example:
$sudo dpkg -i foo.deb ./config.xml
Maybe there is some other solution? Please advise.
You cannot directly pass command-line arguments to postinst
. The usual solution to what you seem to be asking is to have a configure
script, possibly with some values from debconf
to customize it for the target system; if you don't need that, you can probably just hardcode it to read /usr/share/lib/yourpackage/config.xml
and include that file in the package. (Maybe mark that as a conffile
if you expect or even require the admin to change those settings.)