Control: tags -1 patch

This changes postinst and postrm hooks to set bootdir correctly and
consistently with initramfs-tools.

Ben.

--- a/debian/kernel/postinst.d/dracut
+++ b/debian/kernel/postinst.d/dracut
@@ -1,20 +1,21 @@
 #!/bin/sh
 
 version="$1"
-bootopt=""
+bootdir=/boot
 
 [ -x /usr/bin/dracut ] || exit 0
 
 # passing the kernel version is required
 [ -z "${version}" ] && exit 0
 
-# kernel-package passes an extra arg
+# absolute file name of kernel image may be passed as a second argument;
+# create the initrd in the same directory
 if [ -n "$2" ]; then
        if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
                # exit if custom kernel does not need an initramfs
                [ "$INITRD" = 'No' ] && exit 0
-               bootdir=$(dirname "$2")
        fi
+       bootdir=$(dirname "$2")
 fi
 
 # avoid running multiple times
@@ -25,10 +26,6 @@
        fi
 fi
 
-if [ -z "$bootdir" ]; then
-    bootdir=/boot
-fi
-
 # check if modules.dep already exists. If not create it
 # maybe this problem could also be solved via Debian triggers
 if [ ! -f $bootdir/../lib/modules/$version/modules.dep ]; then
--- a/debian/kernel/postrm.d/dracut
+++ b/debian/kernel/postrm.d/dracut
@@ -1,16 +1,15 @@
 #!/bin/sh
 
 version="$1"
-bootopt=""
+bootdir=/boot
 
 # passing the kernel version is required
 [ -z "${version}" ] && exit 0
 
-# kernel-package passes an extra arg
+# absolute file name of kernel image may be passed as a second argument;
+# remove the initrd from the same directory
 if [ -n "$2" ]; then
-       if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
-               bootdir=$(dirname "$2")
-       fi
+       bootdir=$(dirname "$2")
 fi
 
 # avoid running multiple times
--- END ---

-- 
Ben Hutchings
DNRC Motto:  I can please only one person per day.
Today is not your day.  Tomorrow isn't looking good either.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to