|
|
@ -154,6 +154,10 @@ dracut_no_switch_root() { |
|
|
|
>"$initdir/lib/dracut/no-switch-root" |
|
|
|
>"$initdir/lib/dracut/no-switch-root" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dracut_module_path() { |
|
|
|
|
|
|
|
echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ! [[ $DRACUT_INSTALL ]]; then |
|
|
|
if ! [[ $DRACUT_INSTALL ]]; then |
|
|
|
DRACUT_INSTALL=$(find_binary dracut-install) |
|
|
|
DRACUT_INSTALL=$(find_binary dracut-install) |
|
|
|
fi |
|
|
|
fi |
|
|
@ -571,15 +575,16 @@ inst_opt_decompress() { |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_check <dracut module> |
|
|
|
# module_check <dracut module> [<forced>] [<module path>] |
|
|
|
# execute the check() function of module-setup.sh of <dracut module> |
|
|
|
# execute the check() function of module-setup.sh of <dracut module> |
|
|
|
# or the "check" script, if module-setup.sh is not found |
|
|
|
# or the "check" script, if module-setup.sh is not found |
|
|
|
# "check $hostonly" is called |
|
|
|
# "check $hostonly" is called |
|
|
|
module_check() { |
|
|
|
module_check() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$3 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
local _forced=0 |
|
|
|
local _forced=0 |
|
|
|
local _hostonly=$hostonly |
|
|
|
local _hostonly=$hostonly |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[ $# -eq 2 ] && _forced=$2 |
|
|
|
[ $# -eq 2 ] && _forced=$2 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
@ -602,14 +607,15 @@ module_check() { |
|
|
|
return $_ret |
|
|
|
return $_ret |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_check_mount <dracut module> |
|
|
|
# module_check_mount <dracut module> [<module path>] |
|
|
|
# execute the check() function of module-setup.sh of <dracut module> |
|
|
|
# execute the check() function of module-setup.sh of <dracut module> |
|
|
|
# or the "check" script, if module-setup.sh is not found |
|
|
|
# or the "check" script, if module-setup.sh is not found |
|
|
|
# "mount_needs=1 check 0" is called |
|
|
|
# "mount_needs=1 check 0" is called |
|
|
|
module_check_mount() { |
|
|
|
module_check_mount() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$2 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
mount_needs=1 |
|
|
|
mount_needs=1 |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
# if we do not have a check script, we are unconditionally included |
|
|
|
# if we do not have a check script, we are unconditionally included |
|
|
@ -628,12 +634,13 @@ module_check_mount() { |
|
|
|
return $_ret |
|
|
|
return $_ret |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_depends <dracut module> |
|
|
|
# module_depends <dracut module> [<module path>] |
|
|
|
# execute the depends() function of module-setup.sh of <dracut module> |
|
|
|
# execute the depends() function of module-setup.sh of <dracut module> |
|
|
|
# or the "depends" script, if module-setup.sh is not found |
|
|
|
# or the "depends" script, if module-setup.sh is not found |
|
|
|
module_depends() { |
|
|
|
module_depends() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$2 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
# if we do not have a check script, we have no deps |
|
|
|
# if we do not have a check script, we have no deps |
|
|
@ -651,12 +658,13 @@ module_depends() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_cmdline <dracut module> |
|
|
|
# module_cmdline <dracut module> [<module path>] |
|
|
|
# execute the cmdline() function of module-setup.sh of <dracut module> |
|
|
|
# execute the cmdline() function of module-setup.sh of <dracut module> |
|
|
|
# or the "cmdline" script, if module-setup.sh is not found |
|
|
|
# or the "cmdline" script, if module-setup.sh is not found |
|
|
|
module_cmdline() { |
|
|
|
module_cmdline() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$2 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline" |
|
|
|
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline" |
|
|
@ -672,12 +680,13 @@ module_cmdline() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_install <dracut module> |
|
|
|
# module_install <dracut module> [<module path>] |
|
|
|
# execute the install() function of module-setup.sh of <dracut module> |
|
|
|
# execute the install() function of module-setup.sh of <dracut module> |
|
|
|
# or the "install" script, if module-setup.sh is not found |
|
|
|
# or the "install" script, if module-setup.sh is not found |
|
|
|
module_install() { |
|
|
|
module_install() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$2 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
[[ -x $_moddir/install ]] && . "$_moddir/install" |
|
|
|
[[ -x $_moddir/install ]] && . "$_moddir/install" |
|
|
@ -693,12 +702,13 @@ module_install() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# module_installkernel <dracut module> |
|
|
|
# module_installkernel <dracut module> [<module path>] |
|
|
|
# execute the installkernel() function of module-setup.sh of <dracut module> |
|
|
|
# execute the installkernel() function of module-setup.sh of <dracut module> |
|
|
|
# or the "installkernel" script, if module-setup.sh is not found |
|
|
|
# or the "installkernel" script, if module-setup.sh is not found |
|
|
|
module_installkernel() { |
|
|
|
module_installkernel() { |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$2 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
[[ -d $_moddir ]] || return 1 |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
if [[ ! -f $_moddir/module-setup.sh ]]; then |
|
|
|
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel" |
|
|
|
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel" |
|
|
@ -714,15 +724,16 @@ module_installkernel() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# check_mount <dracut module> |
|
|
|
# check_mount <dracut module> [<use_as_dep>] [<module path>] |
|
|
|
# check_mount checks, if a dracut module is needed for the given |
|
|
|
# check_mount checks, if a dracut module is needed for the given |
|
|
|
# device and filesystem types in "${host_fs_types[@]}" |
|
|
|
# device and filesystem types in "${host_fs_types[@]}" |
|
|
|
check_mount() { |
|
|
|
check_mount() { |
|
|
|
local _mod=$1 |
|
|
|
local _mod=$1 |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$3 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
local _moddep |
|
|
|
local _moddep |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
[ "${#host_fs_types[@]}" -le 0 ] && return 1 |
|
|
|
[ "${#host_fs_types[@]}" -le 0 ] && return 1 |
|
|
|
|
|
|
|
|
|
|
|
# If we are already scheduled to be loaded, no need to check again. |
|
|
|
# If we are already scheduled to be loaded, no need to check again. |
|
|
@ -739,7 +750,7 @@ check_mount() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then |
|
|
|
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then |
|
|
|
module_check_mount $_mod; ret=$? |
|
|
|
module_check_mount $_mod $_moddir; ret=$? |
|
|
|
|
|
|
|
|
|
|
|
# explicit module, so also accept ret=255 |
|
|
|
# explicit module, so also accept ret=255 |
|
|
|
[[ $ret = 0 || $ret = 255 ]] || return 1 |
|
|
|
[[ $ret = 0 || $ret = 255 ]] || return 1 |
|
|
@ -747,14 +758,14 @@ check_mount() { |
|
|
|
# module not in our list |
|
|
|
# module not in our list |
|
|
|
if [[ $dracutmodules = all ]]; then |
|
|
|
if [[ $dracutmodules = all ]]; then |
|
|
|
# check, if we can and should install this module |
|
|
|
# check, if we can and should install this module |
|
|
|
module_check_mount $_mod || return 1 |
|
|
|
module_check_mount $_mod $_moddir || return 1 |
|
|
|
else |
|
|
|
else |
|
|
|
# skip this module |
|
|
|
# skip this module |
|
|
|
return 1 |
|
|
|
return 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
for _moddep in $(module_depends $_mod); do |
|
|
|
for _moddep in $(module_depends $_mod $_moddir); do |
|
|
|
# handle deps as if they were manually added |
|
|
|
# handle deps as if they were manually added |
|
|
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \ |
|
|
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \ |
|
|
|
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \ |
|
|
|
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \ |
|
|
@ -778,15 +789,17 @@ check_mount() { |
|
|
|
return 0 |
|
|
|
return 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# check_module <dracut module> [<use_as_dep>] |
|
|
|
# check_module <dracut module> [<use_as_dep>] [<module path>] |
|
|
|
# check if a dracut module is to be used in the initramfs process |
|
|
|
# check if a dracut module is to be used in the initramfs process |
|
|
|
# if <use_as_dep> is set, then the process also keeps track |
|
|
|
# if <use_as_dep> is set, then the process also keeps track |
|
|
|
# that the modules were checked for the dependency tracking process |
|
|
|
# that the modules were checked for the dependency tracking process |
|
|
|
check_module() { |
|
|
|
check_module() { |
|
|
|
local _mod=$1 |
|
|
|
local _mod=$1 |
|
|
|
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }) |
|
|
|
local _moddir=$3 |
|
|
|
local _ret |
|
|
|
local _ret |
|
|
|
local _moddep |
|
|
|
local _moddep |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1") |
|
|
|
# If we are already scheduled to be loaded, no need to check again. |
|
|
|
# If we are already scheduled to be loaded, no need to check again. |
|
|
|
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 |
|
|
|
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0 |
|
|
|
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 |
|
|
|
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1 |
|
|
@ -803,9 +816,9 @@ check_module() { |
|
|
|
|
|
|
|
|
|
|
|
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then |
|
|
|
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then |
|
|
|
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then |
|
|
|
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then |
|
|
|
module_check $_mod 1; ret=$? |
|
|
|
module_check $_mod 1 $_moddir; ret=$? |
|
|
|
else |
|
|
|
else |
|
|
|
module_check $_mod 0; ret=$? |
|
|
|
module_check $_mod 0 $_moddir; ret=$? |
|
|
|
fi |
|
|
|
fi |
|
|
|
# explicit module, so also accept ret=255 |
|
|
|
# explicit module, so also accept ret=255 |
|
|
|
[[ $ret = 0 || $ret = 255 ]] || return 1 |
|
|
|
[[ $ret = 0 || $ret = 255 ]] || return 1 |
|
|
@ -813,7 +826,7 @@ check_module() { |
|
|
|
# module not in our list |
|
|
|
# module not in our list |
|
|
|
if [[ $dracutmodules = all ]]; then |
|
|
|
if [[ $dracutmodules = all ]]; then |
|
|
|
# check, if we can and should install this module |
|
|
|
# check, if we can and should install this module |
|
|
|
module_check $_mod; ret=$? |
|
|
|
module_check $_mod 0 $_moddir; ret=$? |
|
|
|
if [[ $ret != 0 ]]; then |
|
|
|
if [[ $ret != 0 ]]; then |
|
|
|
[[ $2 ]] && return 1 |
|
|
|
[[ $2 ]] && return 1 |
|
|
|
[[ $ret != 255 ]] && return 1 |
|
|
|
[[ $ret != 255 ]] && return 1 |
|
|
@ -824,7 +837,7 @@ check_module() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
for _moddep in $(module_depends $_mod); do |
|
|
|
for _moddep in $(module_depends $_mod $_moddir); do |
|
|
|
# handle deps as if they were manually added |
|
|
|
# handle deps as if they were manually added |
|
|
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \ |
|
|
|
[[ " $dracutmodules " == *\ $_mod\ * ]] \ |
|
|
|
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \ |
|
|
|
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \ |
|
|
@ -849,7 +862,7 @@ check_module() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# for_each_module_dir <func> |
|
|
|
# for_each_module_dir <func> |
|
|
|
# execute "<func> <dracut module> 1" |
|
|
|
# execute "<func> <dracut module> 1 <module path>" |
|
|
|
for_each_module_dir() { |
|
|
|
for_each_module_dir() { |
|
|
|
local _modcheck |
|
|
|
local _modcheck |
|
|
|
local _mod |
|
|
|
local _mod |
|
|
@ -861,7 +874,7 @@ for_each_module_dir() { |
|
|
|
[[ -e $_moddir/install || -e $_moddir/installkernel || \ |
|
|
|
[[ -e $_moddir/install || -e $_moddir/installkernel || \ |
|
|
|
-e $_moddir/module-setup.sh ]] || continue |
|
|
|
-e $_moddir/module-setup.sh ]] || continue |
|
|
|
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]} |
|
|
|
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]} |
|
|
|
$_func $_mod 1 |
|
|
|
$_func $_mod 1 $_moddir |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
# Report any missing dracut modules, the user has specified |
|
|
|
# Report any missing dracut modules, the user has specified |
|
|
|