|
Harald Hoyer |
0840a3 |
From 01e60ca4f63536025d66610679a7a757907e71c8 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
0840a3 |
From: Thomas Renninger <trenn@suse.de>
|
|
Harald Hoyer |
0840a3 |
Date: Fri, 26 Jun 2015 16:55:53 +0200
|
|
Harald Hoyer |
0840a3 |
Subject: [PATCH] mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be
|
|
Harald Hoyer |
0840a3 |
generated
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
|
Harald Hoyer |
0840a3 |
---
|
|
Harald Hoyer |
0840a3 |
mkinitrd-suse.sh | 17 ++++++++++++++++-
|
|
Harald Hoyer |
0840a3 |
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
|
|
Harald Hoyer |
0840a3 |
index af42cbe..c2b314f 100755
|
|
Harald Hoyer |
0840a3 |
--- a/mkinitrd-suse.sh
|
|
Harald Hoyer |
0840a3 |
+++ b/mkinitrd-suse.sh
|
|
Harald Hoyer |
0840a3 |
@@ -280,7 +280,8 @@ done
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
[[ $targets && $kernels ]] || default_kernel_images
|
|
Harald Hoyer |
0840a3 |
if [[ ! $targets || ! $kernels ]];then
|
|
Harald Hoyer |
0840a3 |
- error "No kernel found in $boot_dir"
|
|
Harald Hoyer |
0840a3 |
+ error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
|
|
Harald Hoyer |
0840a3 |
+ exit 1
|
|
Harald Hoyer |
0840a3 |
fi
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
# We can have several targets/kernels, transform the list to an array
|
|
Harald Hoyer |
0840a3 |
@@ -301,6 +302,8 @@ fi
|
|
Harald Hoyer |
0840a3 |
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
|
|
Harald Hoyer |
0840a3 |
shopt -s extglob
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
+failed=""
|
|
Harald Hoyer |
0840a3 |
+
|
|
Harald Hoyer |
0840a3 |
for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
|
Harald Hoyer |
0840a3 |
|
|
Harald Hoyer |
0840a3 |
if [[ $img_vers ]];then
|
|
Harald Hoyer |
0840a3 |
@@ -329,14 +332,18 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
|
Harald Hoyer |
0840a3 |
# expansion magics
|
|
Harald Hoyer |
0840a3 |
if [ -n "${modules_all}" ];then
|
|
Harald Hoyer |
0840a3 |
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
|
|
Harald Hoyer |
0840a3 |
+ [ $? -ne 0 ] && failed="$failed $target"
|
|
Harald Hoyer |
0840a3 |
else
|
|
Harald Hoyer |
0840a3 |
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
|
|
Harald Hoyer |
0840a3 |
+ [ $? -ne 0 ] && failed="$failed $target"
|
|
Harald Hoyer |
0840a3 |
fi
|
|
Harald Hoyer |
0840a3 |
else
|
|
Harald Hoyer |
0840a3 |
if [ -n "${modules_all}" ];then
|
|
Harald Hoyer |
0840a3 |
$dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
|
|
Harald Hoyer |
0840a3 |
+ [ $? -ne 0 ] && failed="$failed $target"
|
|
Harald Hoyer |
0840a3 |
else
|
|
Harald Hoyer |
0840a3 |
$dracut_cmd $dracut_args "$target" "$kernel"
|
|
Harald Hoyer |
0840a3 |
+ [ $? -ne 0 ] && failed="$failed $target"
|
|
Harald Hoyer |
0840a3 |
fi
|
|
Harald Hoyer |
0840a3 |
fi
|
|
Harald Hoyer |
0840a3 |
done
|
|
Harald Hoyer |
0840a3 |
@@ -345,4 +352,12 @@ if [ "$skip_update_bootloader" ] ; then
|
|
Harald Hoyer |
0840a3 |
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
|
|
Harald Hoyer |
0840a3 |
else
|
|
Harald Hoyer |
0840a3 |
update-bootloader --refresh
|
|
Harald Hoyer |
0840a3 |
+ [ $? -ne 0 ] && echo "Updating bootloader failed" && exit 1
|
|
Harald Hoyer |
0840a3 |
+fi
|
|
Harald Hoyer |
0840a3 |
+
|
|
Harald Hoyer |
0840a3 |
+if [ "$failed" != "" ]; then
|
|
Harald Hoyer |
0840a3 |
+ echo "Generating $failed targets failed"
|
|
Harald Hoyer |
0840a3 |
+ exit 1
|
|
Harald Hoyer |
0840a3 |
fi
|
|
Harald Hoyer |
0840a3 |
+
|
|
Harald Hoyer |
0840a3 |
+exit 0
|