Set a script to run automatically after apt-get dist-upgrade, install, remove and purge?
How would I automatically run a script after the apt-get
actions dist-upgrade
, install
, remove
and purge
? Is there a suitable way of hooking into the APT lifecycle and run a custom script?
Solution 1:
You can automatically run a script by creating a new file /etc/apt/apt.conf.d/99ownscript
containing:
DPkg::Post-Invoke {"/bin/bash /path/to/script.sh"; };
Note that this file does not have to be executable, just 644 mode is sufficient.