toltec icon indicating copy to clipboard operation
toltec copied to clipboard

Provide generic post-install hooks

Open matteodelabre opened this issue 3 years ago • 0 comments

Some packages may be interested in running hooks whenever other packages install files in specific directories. For example, Oxide needs to know when applications are added to /opt/usr/share/applications to update its internal application list.

  • Arch Linux has hooks that are added by dropping files in /usr/share/libalpm/hooks. Hooks can be triggered when a package is installed, upgraded or removed, or when files matching a given pattern are installed, upgraded or removed.
  • Debian has triggers that are configured by a control file called triggers in each package. The triggers are either named and manually fired with the dpkg-trigger command (called for example from a maintainer script) or file-based and automatically fired when a file matching a pattern is installed, upgraded or removed. See also dpkg-trigger and the draft specification for dpkg triggers (2007).
  • As far as I know, neither opkg nor its LEDE fork has a similar functionality.

Currently, an Oxide-specific workaround is hardcoded in package-build to generate appropriate maintainer scripts when a package installs files to /opt/usr/share/applications.

https://github.com/toltec-dev/toltec/blob/0d8ff3716e60f149d5cdfd84411c725dcc671a65/scripts/package-build#L253

This idea could be expanded upon and made more generic. This would not require any modification of opkg, but does not allow batching triggers together. Another way would be to implement this functionality in opkg (either in a fork, or by proposing such changes upstream). A third possibility is to make a Bash wrapper for opkg which manages the triggers.

matteodelabre avatar Jan 21 '21 11:01 matteodelabre