title: How to automate linux kernel module compilation when installing a new kernel?
body: <p>I am writing a Linux kernel module. It is released with all the source files (although the license is proprietary) to be compiled against the running kernel. When installing my module (distributed as a <code>.deb</code> package) it is compiled and installed automatically. This works.</p>
  
  <p>The issue is that during the regular upgrade process of the whole Linux systems, newer version of the Linux kernel are installed. When such a new version of the kernel starts to run, it does not have my module compiled for it, and my application fails. I'd like my module to be compiled and installed whenever a new Linux kernel package is installed.</p>
  
  <p>Hence my question: is there a mechanism in <code>dpkg</code> that could trigger something in my package to compile and install my module when a new Linux kernel package is installed?</p>
  
  <p>Same question for <code>rpm</code>?</p>