passing a parameter into dpkg -i?
-
28-06-2021 - |
Pregunta
Is there any way to pass a parameter into dpkg -i that can then be used by preinst and postinst? I've looked into this and was wondering if I could refer to these parameters with $1 or $2
Thanks in advance
Solución
No, you cannot pass a parameter that way.
You can set an environmental variable this way
$ VARIABLE=foo dpkg --install package.deb
or (much better) use debconf to ask questions to the user.
Otros consejos
You know, the parameters of an application are visible with the debconf-get-selections
command. i.e. debconf-get-selections | grep myapp
Assume there're two parameters available for your deb package, so you can perform non-interactive install like this:
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.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow