2

I'm thinking of writing an RPM that contains a Python virtual environment. A Python virtual environment contains a copy of the Python executable (which is a thin shell around the Python shared library). This means that if Python is ever updated, the Python executable inside that virtual environment should also be updated.

Is it possible for an RPM to have a script that runs every time a dependency is updated? I've noticed that akmod seems to know to recompile kernel modules every time you update the kernel. Does it do this by hooking RPM, or by some sort of 'on-boot' script that checks what kernel is running?

3

On RHEL and Fedora systems, the kernel package is special in that there is a /usr/lib/kernel/install.d and /etc/kernel/install.d that have scripts for running during kernel installs, and /usr/lib/kernel/postinst.d and /etc/kernel/postinst.d for after install. Other packages, such as akmods or dkms can drop scripts in the appropriate directory to invoke scripts related to kernel installs. This is all handled by the new-kernel-pkg command, I believe.

If you're using RPM 4 or greater, there are triggers you can define in your RPM spec that trigger off the upgrade of a specific package. Check out the documentation in /usr/share/doc/rpm/triggers.

  • We're using CentOS 7. I'm not sure which RPM version it uses. Easy enough to find out though. Thanks! – Omnifarious Aug 2 at 14:28
  • Yeah, C7 has the triggers document here: /usr/share/doc/rpm-4.11.3/triggers – jsbillings Aug 2 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.