67 lines
2.1 KiB
Diff
67 lines
2.1 KiB
Diff
|
From 01e60ca4f63536025d66610679a7a757907e71c8 Mon Sep 17 00:00:00 2001
|
||
|
From: Thomas Renninger <trenn@suse.de>
|
||
|
Date: Fri, 26 Jun 2015 16:55:53 +0200
|
||
|
Subject: [PATCH] mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be
|
||
|
generated
|
||
|
|
||
|
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 af42cbe..c2b314f 100755
|
||
|
--- a/mkinitrd-suse.sh
|
||
|
+++ b/mkinitrd-suse.sh
|
||
|
@@ -280,7 +280,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
|
||
|
@@ -301,6 +302,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
|
||
|
@@ -329,14 +332,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
|
||
|
@@ -345,4 +352,12 @@ if [ "$skip_update_bootloader" ] ; then
|
||
|
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
|
||
|
else
|
||
|
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
|