File 0120-mkinitrd-suse.sh-Bail-out-with-exit-1-if-initrd-cann.patch of Package dracut.1835
From 3c4d4b2c9654e418d422b80e052bdf6d9a02a188 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Tue, 15 Jul 2014 15:53:23 +0200
Subject: mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be generated
bnc#886630
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
mkinitrd-suse.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
index bf10a9d..5b32e6c 100755
--- a/mkinitrd-suse.sh
+++ b/mkinitrd-suse.sh
@@ -282,7 +282,8 @@ done
[[ $targets && $kernels ]] || default_kernel_images
if [[ ! $targets || ! $kernels ]];then
- error "No kernel found in $boot_dir"
+ error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
+ exit 1
fi
# We can have several targets/kernels, transform the list to an array
@@ -303,6 +304,8 @@ fi
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
shopt -s extglob
+failed=""
+
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
@@ -331,14 +334,18 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
# expansion magics
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
+ [ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
+ [ $? -ne 0 ] && failed="$failed $target"
fi
else
if [ -n "${modules_all}" ];then
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
+ [ $? -ne 0 ] && failed="$failed $target"
else
$dracut_cmd $dracut_args "$target" "$kernel"
+ [ $? -ne 0 ] && failed="$failed $target"
fi
fi
done
@@ -348,4 +355,12 @@ if [ "$skip_update_bootloader" ] ; then
else
echo "Update bootloader..."
update-bootloader --refresh
+ [ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
+fi
+
+if [ "$failed" != "" ]; then
+ echo "Generating $failed targets failed"
+ exit 1
fi
+
+exit 0
--
1.8.4.5