Sample Header Ad - 728x90

Dpkg env variable DPKG_HOOK_ACTION is not set in hook script

3 votes
2 answers
1589 views
According to man dpkg I can use DPKG_HOOK_ACTION to get the current dpkg action being run in my dpkg hook script --pre-invoke=command --post-invoke=command Set an invoke hook command to be run via “sh -c” before or after the dpkg run for the unpack, configure, install, triggers-only, remove and purge dpkg actions. This option can be specified multiple times. The order the options are specified is preserved, with the ones from the configuration files taking precedence. The environment variable DPKG_HOOK_ACTION is set for the hooks to the current dpkg action. Note: front-ends might call dpkg several times per invocation, which might run the hooks more times than expected. but it doesn't seem to work in this hook command. Any idea what is wrong here? $ cat /etc/apt/apt.conf.d/99testhook DPkg::Pre-Invoke {"echo This is testhook. Current action is $DPKG_HOOK_ACTION; exit 0";}; $ sudo apt-get install screen ... Fetched 628 kB in 0s (4,366 kB/s) This is testhook. Current action is Selecting previously unselected package screen.
Asked by Flint (277 rep)
Dec 10, 2014, 09:32 AM
Last activity: Jul 14, 2020, 01:16 PM