|
|
712866 |
From 6914b67545633d23063d5c5812591c67df56c0cf Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Fri, 24 Oct 2014 13:19:58 +0200
|
|
|
712866 |
Subject: [PATCH] dracut: fixed module dependency handling
|
|
|
712866 |
|
|
|
712866 |
Fail for "--modules" and "--force-add" dracut modules, if they or their
|
|
|
712866 |
dependencies cannot be included.
|
|
|
712866 |
|
|
|
712866 |
(cherry picked from commit ab2f95e45ed9803c5cbee23f41201a0f934f8043)
|
|
|
712866 |
---
|
|
|
712866 |
dracut-functions.sh | 37 ++++++++++++++++++++++++++-----------
|
|
|
712866 |
dracut.sh | 4 +++-
|
|
|
712866 |
2 files changed, 29 insertions(+), 12 deletions(-)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
|
5c6c2a |
index 6e0b44ae..89438b29 100755
|
|
|
712866 |
--- a/dracut-functions.sh
|
|
|
712866 |
+++ b/dracut-functions.sh
|
|
|
712866 |
@@ -1215,13 +1215,17 @@ check_mount() {
|
|
|
712866 |
fi
|
|
|
712866 |
fi
|
|
|
712866 |
|
|
|
712866 |
-
|
|
|
712866 |
for _moddep in $(module_depends $_mod); do
|
|
|
712866 |
# handle deps as if they were manually added
|
|
|
712866 |
- [[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
|
|
712866 |
- add_dracutmodules+=" $_moddep "
|
|
|
712866 |
- [[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
|
|
712866 |
- force_add_dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && add_dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && force_add_dracutmodules+=" $_moddep "
|
|
|
712866 |
# if a module we depend on fail, fail also
|
|
|
712866 |
if ! check_module $_moddep; then
|
|
|
712866 |
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
|
|
712866 |
@@ -1259,7 +1263,7 @@ check_module() {
|
|
|
712866 |
fi
|
|
|
712866 |
|
|
|
712866 |
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
|
|
712866 |
- if [[ " $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
|
|
712866 |
+ if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
|
|
712866 |
module_check $_mod 1; ret=$?
|
|
|
712866 |
else
|
|
|
712866 |
module_check $_mod 0; ret=$?
|
|
|
712866 |
@@ -1270,7 +1274,11 @@ check_module() {
|
|
|
712866 |
# module not in our list
|
|
|
712866 |
if [[ $dracutmodules = all ]]; then
|
|
|
712866 |
# check, if we can and should install this module
|
|
|
712866 |
- module_check $_mod || return 1
|
|
|
712866 |
+ module_check $_mod; ret=$?
|
|
|
712866 |
+ if [[ $ret != 0 ]]; then
|
|
|
712866 |
+ [[ $2 ]] && return 1
|
|
|
712866 |
+ [[ $ret != 255 ]] && return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
else
|
|
|
712866 |
# skip this module
|
|
|
712866 |
return 1
|
|
|
712866 |
@@ -1279,10 +1287,15 @@ check_module() {
|
|
|
712866 |
|
|
|
712866 |
for _moddep in $(module_depends $_mod); do
|
|
|
712866 |
# handle deps as if they were manually added
|
|
|
712866 |
- [[ " $add_dracutmodules " == *\ $_moddep\ * ]] || \
|
|
|
712866 |
- add_dracutmodules+=" $_moddep "
|
|
|
712866 |
- [[ " $force_add_dracutmodules " == *\ $_moddep\ * ]] || \
|
|
|
712866 |
- force_add_dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $add_dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $add_dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && add_dracutmodules+=" $_moddep "
|
|
|
712866 |
+ [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $force_add_dracutmodules " != *\ $_moddep\ * ]] \
|
|
|
712866 |
+ && force_add_dracutmodules+=" $_moddep "
|
|
|
712866 |
# if a module we depend on fail, fail also
|
|
|
712866 |
if ! check_module $_moddep; then
|
|
|
712866 |
derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
|
|
|
712866 |
@@ -1319,11 +1332,13 @@ for_each_module_dir() {
|
|
|
712866 |
[[ " $mods_to_load " == *\ $_mod\ * ]] && continue
|
|
|
712866 |
|
|
|
712866 |
[[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
|
|
|
712866 |
+ && [[ " $dracutmodules " != *\ $_mod\ * ]] \
|
|
|
712866 |
&& [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
|
|
|
712866 |
&& continue
|
|
|
712866 |
|
|
|
712866 |
derror "dracut module '$_mod' cannot be found or installed."
|
|
|
712866 |
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
|
|
712866 |
+ [[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
|
|
|
712866 |
[[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
|
|
|
712866 |
done
|
|
|
712866 |
}
|
|
|
712866 |
diff --git a/dracut.sh b/dracut.sh
|
|
|
5c6c2a |
index eff096e5..74c59a0c 100755
|
|
|
712866 |
--- a/dracut.sh
|
|
|
712866 |
+++ b/dracut.sh
|
|
|
712866 |
@@ -1152,7 +1152,9 @@ fi
|
|
|
712866 |
|
|
|
712866 |
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
|
|
712866 |
|
|
|
712866 |
-export initdir dracutbasedir dracutmodules \
|
|
|
712866 |
+export initdir dracutbasedir \
|
|
|
712866 |
+ dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
|
|
|
712866 |
+ mods_to_load \
|
|
|
712866 |
fw_dir drivers_dir debug no_kernel kernel_only \
|
|
|
712866 |
omit_drivers mdadmconf lvmconf root_dev \
|
|
|
712866 |
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
|