Passing a parameter to dpkg -i?

Is there a way to pass a parameter to dpkg -i, which can then be used by preinst and postinst? I studied this and wondered if I can refer to these parameters using $ 1 or $ 2

Thanks in advance

+6
source share
2 answers

No, you cannot pass a parameter this way.

This way you can set the environment variable.

$ VARIABLE=foo dpkg --install package.deb 

or (much better) use debconf to ask questions to the user.

+7
source

You know, application parameters are visible with the debconf-get-selections command. those. debconf-get-selections | grep myapp

Suppose two options are available for your deb package, so you can perform a silent installation as follows:

 echo myapp myapp/param1 string 8888 | debconf-set-selections echo myapp myapp/param2 boolean true | debconf-set-selections DEBIAN_FRONTEND=noninteractive dpkg -i blablabla.deb 

Now you can use param1 and param2 in your preinst and postinst.

0
source

Source: https://habr.com/ru/post/924005/


All Articles