We should not continue after a command unexpectedly fails.
Change the $INITRD test so that failure is not treated as unexpected.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
kernel/postinst.d/initramfs-tools | 6 ++++--
kernel/postrm.d/initramfs-tools | 6 +++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools
index f312e43..b36d713 100755
--- a/kernel/postinst.d/initramfs-tools
+++ b/kernel/postinst.d/initramfs-tools
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
version="$1"
bootopt=""
@@ -13,7 +13,9 @@ fi
if [ -n "$2" ]; then
if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
# exit if custom kernel does not need an initramfs
- [ "$INITRD" = 'No' ] && exit 0
+ if [ "$INITRD" = 'No' ]; then
+ exit 0
+ fi
bootdir=$(dirname "$2")
bootopt="-b ${bootdir}"
else
diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools
index 051c8de..36fb61f 100755
--- a/kernel/postrm.d/initramfs-tools
+++ b/kernel/postrm.d/initramfs-tools
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
version="$1"
bootopt=""
@@ -12,6 +12,10 @@ fi
# kernel-package passes an extra arg
if [ -n "$2" ]; then
if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
+ # exit if custom kernel does not need an initramfs
+ if [ "$INITRD" = 'No' ]; then
+ exit 0
+ fi
bootdir=$(dirname "$2")
bootopt="-b ${bootdir}"
else
--
1.7.4.1
Attachment:
signature.asc
Description: This is a digitally signed message part