2006-10-27

Re: Wacky ideas #9: rerun maintainer scripts for changes in related packages

Posted in Computers, PlanetDebian at 20:57 CEST (+0200) by sven

Interestingly, Simon Richter write about rerunning maintainer scripts for changes in related packages just when I thought that it would really be nice to get SpamPD (a SMTP-proxy in Perl which scans mails for spam using the Mail::SpamAssassin Perl module) restarted when SpamAssassin gets updated. Or to get spamd (which is part of SpamAssassin) restarted when a plugin is updated, removed or installed. Of course the second one is easier since the plugin package “knows” that SpamAssassin is affected by the change and can thus reload/restart spamd.
One idea I had for this is to create a hierarchy to which an admin or maintainer could add scripts (effectively providing hooks), like this:
/var/lib/dpkg/hooks/<package>/(removal|update|install)/(pre|post)/<hook-package>
Where <hook-package> would be the package installing the hook while <package> is the package for which the action is to be “monitored”.So that I as the SpamPD maintainer could make the spampd package install a script in
/var/lib/dpkg/hooks/spamassassin/update/post/spampd which would get called whenever spamassassin is updated, after the update, to be exact.
An alternative on per-package basis would of course be:
/var/lib/<package>/hooks/(pre|post)inst/<hook-package> or /var/lib/spamassassin/hooks/postinst/spampd for the above example.

I would be quite intested to hear what other devs think about this.

1 Comment

  1. Ted said,

    October 28, 2006 at 02:39 CEST (+0200)

    I’d be inclined to remove the (removal|update|install) directory and instead make that an argument to the script, because there is likely to be a lot of duplicated code for each action. Consider init scripts or {pre,post}{inst,rm} scripts.

    Sounds quite good though. I believe ifupdown or resolvconf provides a similar mechanism, whereby squid (for instance) is reloaded when the network state changes.

    I’m not the maintainer of any packages with daemon-dependencies though :)