Run script after update?

@ashtonaut

as apt is used for updates/upgrades, create file /etc/apt/apt.conf.d/99-post-upgrade with this content:

APT::Update::Post-Invoke-Success {"XXXXXXX";};
APT::Update::Post-Invoke {"YYYYYYY";};
Dpkg::Post-Invoke {"ZZZZZZZZ";};

during apt single run, dpkg is spawned for each .deb package. that means the last line (“dpkg::postinvoke”) would be started for each single installed package, second line once an apt run (regardless of end-status) and 1st line once per run - only if finished successfully.
XXX/YYY/ZZZ are “commands” started in a shell - that means it can be from single command to very complex programming.

basically this would be answer to your question, but I think once there is deb, anything like this is pure complication and unnecessary complex (the “concept” of checking for update + restoring).

deb allows you to deliver same folder/files like another package in the system already installed. that means that you should simply bundle “your changes” into .deb pkg, set this .deb with param “Replaces: xxxxxxx” and install it.
those files will never ever be updated by package “xxxxxxxx” again.

1 Like