]> git.proxmox.com Git - pve-kernel-2.6.32.git/commitdiff
call /etc/kernel hooks
authorDietmar Maurer <dietmar@proxmox.com>
Sun, 11 Jan 2015 07:19:21 +0000 (08:19 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sun, 11 Jan 2015 07:29:20 +0000 (08:29 +0100)
required to work with dkms modules.

Makefile
postinst.in
postrm.in
prerm.in [new file with mode: 0755]

index 35e55edc91f6cf9d27b8fef87a76055ad89da00d..62ea81ae894a60208df21be24e6904299cc85484 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -96,11 +96,13 @@ else
        $(CC) --version|grep "4\.7" || false
 endif
 
-${DST_DEB}: data control.in postinst.in postrm.in
+${DST_DEB}: data control.in postinst.in prerm.in postrm.in
        mkdir -p data/DEBIAN
        sed -e 's/@KERNEL_VER@/${KERNEL_VER}/' -e 's/@KVNAME@/${KVNAME}/' -e 's/@PKGREL@/${PKGREL}/' <control.in >data/DEBIAN/control
        sed -e 's/@@KVNAME@@/${KVNAME}/g'  <postinst.in >data/DEBIAN/postinst
        chmod 0755 data/DEBIAN/postinst
+       sed -e 's/@@KVNAME@@/${KVNAME}/g'  <prerm.in >data/DEBIAN/prerm
+       chmod 0755 data/DEBIAN/prerm
        sed -e 's/@@KVNAME@@/${KVNAME}/g'  <postrm.in >data/DEBIAN/postrm
        chmod 0755 data/DEBIAN/postrm
        install -D -m 644 copyright data/usr/share/doc/${PACKAGE}/copyright
index 0d4971f03944e079d8bcc4900da91278c5dfa426..3340eee40fa4d7f53967528157da85f0ca8c2d4c 100755 (executable)
@@ -14,10 +14,12 @@ my $version = "@@KVNAME@@";
 
 system("depmod $version");
 
-system("update-initramfs -c -t -b $imagedir -k $version"); 
-
-if (-x "/usr/sbin/update-grub") {
-    system("/usr/sbin/update-grub");
+if (-d "/etc/kernel/postinst.d") {
+  print STDERR "Examining /etc/kernel/postinst.d.\n";
+  system ("run-parts --verbose --exit-on-error --arg=$version " .
+          "--arg=$imagedir/vmlinuz-$version " .
+          "/etc/kernel/postinst.d") &&
+            die "Failed to process /etc/kernel/postinst.d";
 }
 
 exit 0
index 8ccfd9aefa00380cdd3a7c7e0bd31a483d9a6161..763dd7d83af1113fdb98d1a20d7dc8c61ede7d01 100644 (file)
--- a/postrm.in
+++ b/postrm.in
@@ -9,6 +9,14 @@ my $imagedir = "/boot";
 
 my $version = "@@KVNAME@@";
 
+if (-d "/etc/kernel/postrm.d") {
+  print STDERR  "Examining /etc/kernel/postrm.d.\n";
+  system ("run-parts --verbose --exit-on-error --arg=$version " .
+          "--arg=$imagedir/vmlinuz-$version " .
+          "/etc/kernel/postrm.d") &&
+            die "Failed to process /etc/kernel/postrm.d";
+}
+
 unlink "$imagedir/initrd.img-$version";
 unlink "$imagedir/initrd.img-$version.bak";
 unlink "/var/lib/initramfs-tools/$version";
diff --git a/prerm.in b/prerm.in
new file mode 100755 (executable)
index 0000000..486f867
--- /dev/null
+++ b/prerm.in
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+# Ignore all invocations uxcept when called on to remove
+exit 0 unless ($ARGV[0] && $ARGV[0] =~ /remove/) ;
+
+# do nothing if run from proxmox installer
+exit 0 if -e "/proxmox_install_mode";
+
+my $imagedir = "/boot";
+
+my $version = "@@KVNAME@@";
+
+if (-d "/etc/kernel/prerm.d") {
+  print STDERR "Examining /etc/kernel/prerm.d.\n";
+  system ("run-parts --verbose --exit-on-error --arg=$version " . 
+          "--arg=$imagedir/vmlinuz-$version " .
+          "/etc/kernel/prerm.d") &&
+         die "Failed to process /etc/kernel/prerm.d";
+}
+
+exit 0