summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkernel/postinst.d/initramfs-tools25
-rwxr-xr-xkernel/postrm.d/initramfs-tools25
2 files changed, 42 insertions, 8 deletions
diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools
index 1cb72a8..b389921 100755
--- a/kernel/postinst.d/initramfs-tools
+++ b/kernel/postinst.d/initramfs-tools
@@ -1,10 +1,27 @@
#!/bin/sh
+version="$1"
+bootopt=""
+
# passing the kernel version is required
-[ -z "$1" ] && exit 0
+[ -z "${version}" ] && exit 0
+
+# kernel-package passes an extra arg
+if [ -n "$2" ]; then
+ if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
+ ${bootdir}= $(dirname "$2")
+ bootopt="-b ${bootdir}"
+ else
+ exit 0
+ fi
+fi
-# kernel-package passes an extra arg; hack to not run under kernel-package
-[ -z "$2" ] || exit 0
+if [ -n "$DEB_MAINT_PARAMS" ]; then
+ eval set -- "$DEB_MAINT_PARAMS"
+ if [ -z "$1" ] || [ "$1" != "configure" ]; then
+ exit 0
+ fi
+fi
# we're good - create initramfs. update runs do_bootloader
-update-initramfs -c -t -k "$1"
+update-initramfs -c -t -k "${version}" ${bootopt}
diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools
index 278a6fc..88c6d07 100755
--- a/kernel/postrm.d/initramfs-tools
+++ b/kernel/postrm.d/initramfs-tools
@@ -1,10 +1,27 @@
#!/bin/sh
+version="$1"
+bootopt=""
+
# passing the kernel version is required
-[ -z "$1" ] && exit 0
+[ -z "${version}" ] && exit 0
+
+# kernel-package passes an extra arg
+if [ -n "$2" ]; then
+ if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
+ ${bootdir}= $(dirname "$2")
+ bootopt="-b ${bootdir}"
+ else
+ exit 0
+ fi
+fi
-# kernel-package passes an extra arg; hack to not run under kernel-package
-[ -z "$2" ] || exit 0
+if [ -n "$DEB_MAINT_PARAMS" ]; then
+ eval set -- "$DEB_MAINT_PARAMS"
+ if [ -z "$1" ] || [ "$1" != "remove" ]; then
+ exit 0
+ fi
+fi
# delete initramfs
-update-initramfs -d -k "$1"
+update-initramfs -d -k "${version}" ${bootopt}