for cmd in "$@"; do
if ! find_binary "$cmd" &> /dev/null; then
- dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
+ dinfo "Module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
((_ret++))
fi
done
for mod in "$@"; do
if ! check_kernel_module "$mod" &> /dev/null; then
- dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because kernel module '$mod' is not available!"
+ dinfo "Module '${_module_name#[0-9][0-9]}' will not be installed, because kernel module '$mod' is not available!"
((_ret++))
fi
done
}
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
-# If hosotnly mode is set to "strict", hostonly restrictions will still
+# If hostonly mode is set to "strict", hostonly restrictions will still
# be applied, else will ignore hostonly mode and try to install all
# given modules.
optional_hostonly() {
inst_rule_initqueue "$_found"
inst_simple "$_found" "$_target/${_found##*/}"
done
- [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
+ [[ $_found ]] || ddebug "Skipping udev rule: $_rule"
done
}
_found=$_rule
done
fi
- [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
+ [[ $_found ]] || ddebug "Skipping udev rule: $_rule"
}
# make sure that library links are correct and up to date
}
prepare_udev_rules() {
+ dwarn "prepare_udev_rules: deprecated and will be removed"
+
if [ -z "$UDEVVERSION" ]; then
UDEVVERSION=$(udevadm --version)
export UDEVVERSION
local _forced=0
local _hostonly=$hostonly
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [ $# -eq 2 ] && _forced=$2
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # if we do not have a check script, we are unconditionally included
- [[ -x $_moddir/check ]] || return 0
- [[ $_forced != 0 ]] && unset hostonly
- # don't quote $hostonly to leave argument empty
- # shellcheck disable=SC2086
- "$_moddir"/check $hostonly
- _ret=$?
- else
- unset check depends cmdline install installkernel
- check() { true; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- is_func check || return 0
- [[ $_forced != 0 ]] && unset hostonly
- # don't quote $hostonly to leave argument empty
- # shellcheck disable=SC2086
- moddir="$_moddir" check $hostonly
- _ret=$?
- unset check depends cmdline install installkernel
- fi
+ [ $# -ge 2 ] && _forced=$2
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ check() { true; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ is_func check || return 0
+ [[ $_forced != 0 ]] && unset hostonly
+ # don't quote $hostonly to leave argument empty
+ # shellcheck disable=SC2086
+ moddir="$_moddir" check $hostonly
+ _ret=$?
+ unset check depends cmdline install installkernel
hostonly=$_hostonly
return $_ret
}
local _ret
export mount_needs=1
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # if we do not have a check script, we are unconditionally included
- [[ -x $_moddir/check ]] || return 0
- mount_needs=1 "$_moddir"/check 0
- _ret=$?
- else
- unset check depends cmdline install installkernel
- check() { false; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- moddir=$_moddir check 0
- _ret=$?
- unset check depends cmdline install installkernel
- fi
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ check() { false; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ moddir=$_moddir check 0
+ _ret=$?
+ unset check depends cmdline install installkernel
unset mount_needs
return "$_ret"
}
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # if we do not have a check script, we have no deps
- [[ -x $_moddir/check ]] || return 0
- "$_moddir"/check -d
- return $?
- else
- unset check depends cmdline install installkernel
- depends() { true; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- moddir=$_moddir depends
- _ret=$?
- unset check depends cmdline install installkernel
- return $_ret
- fi
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ depends() { true; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ moddir=$_moddir depends
+ _ret=$?
+ unset check depends cmdline install installkernel
+ return $_ret
}
# module_cmdline <dracut module> [<module path>]
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # shellcheck disable=SC1090
- [[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
- return $?
- else
- unset check depends cmdline install installkernel
- cmdline() { true; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- moddir="$_moddir" cmdline
- _ret=$?
- unset check depends cmdline install installkernel
- return $_ret
- fi
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ cmdline() { true; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ moddir="$_moddir" cmdline
+ _ret=$?
+ unset check depends cmdline install installkernel
+ return $_ret
}
# module_install <dracut module> [<module path>]
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # shellcheck disable=SC1090
- [[ -x $_moddir/install ]] && . "$_moddir/install"
- return $?
- else
- unset check depends cmdline install installkernel
- install() { true; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- moddir="$_moddir" install
- _ret=$?
- unset check depends cmdline install installkernel
- return $_ret
- fi
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ install() { true; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ moddir="$_moddir" install
+ _ret=$?
+ unset check depends cmdline install installkernel
+ return $_ret
}
# module_installkernel <dracut module> [<module path>]
local _moddir=$2
local _ret
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
- [[ -d $_moddir ]] || return 1
- if [[ ! -f $_moddir/module-setup.sh ]]; then
- # shellcheck disable=SC1090
- [[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
- return $?
- else
- unset check depends cmdline install installkernel
- installkernel() { true; }
- # shellcheck disable=SC1090
- . "$_moddir"/module-setup.sh
- moddir="$_moddir" installkernel
- _ret=$?
- unset check depends cmdline install installkernel
- return $_ret
- fi
+ [[ -f $_moddir/module-setup.sh ]] || return 1
+ unset check depends cmdline install installkernel
+ installkernel() { true; }
+ # shellcheck disable=SC1090
+ . "$_moddir"/module-setup.sh
+ moddir="$_moddir" installkernel
+ _ret=$?
+ unset check depends cmdline install installkernel
+ return $_ret
}
# check_mount <dracut module> [<use_as_dep>] [<module path>]
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
module_check_mount "$_mod" "$_moddir"
- ret=$?
+ _ret=$?
- # explicit module, so also accept ret=255
- [[ $ret == 0 || $ret == 255 ]] || return 1
+ # explicit module, so also accept _ret=255
+ [[ $_ret == 0 || $_ret == 255 ]] || return 1
else
# module not in our list
if [[ $dracutmodules == all ]]; then
&& force_add_dracutmodules+=" $_moddep "
# if a module we depend on fail, fail also
if ! check_module "$_moddep"; then
- derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
+ derror "Module '$_mod' depends on '$_moddep', which can't be installed"
return 1
fi
done
[[ $2 ]] || mods_checked_as_dep+=" $_mod "
if [[ " $omit_dracutmodules " == *\ $_mod\ * ]]; then
- ddebug "dracut module '$_mod' will not be installed, because it's in the list to be omitted!"
+ ddebug "Module '$_mod' will not be installed, because it's in the list to be omitted!"
return 1
fi
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
module_check "$_mod" 1 "$_moddir"
- ret=$?
+ _ret=$?
else
module_check "$_mod" 0 "$_moddir"
- ret=$?
+ _ret=$?
fi
- # explicit module, so also accept ret=255
- [[ $ret == 0 || $ret == 255 ]] || return 1
+ # explicit module, so also accept _ret=255
+ [[ $_ret == 0 || $_ret == 255 ]] || return 1
else
# module not in our list
if [[ $dracutmodules == all ]]; then
# check, if we can and should install this module
module_check "$_mod" 0 "$_moddir"
- ret=$?
- if [[ $ret != 0 ]]; then
+ _ret=$?
+ if [[ $_ret != 0 ]]; then
[[ $2 ]] && return 1
- [[ $ret != 255 ]] && return 1
+ [[ $_ret != 255 ]] && return 1
fi
else
# skip this module
&& force_add_dracutmodules+=" $_moddep "
# if a module we depend on fail, fail also
if ! check_module "$_moddep"; then
- derror "dracut module '$_mod' depends on '$_moddep', which can't be installed"
+ derror "Module '$_mod' depends on '$_moddep', which can't be installed"
return 1
fi
done
local _mod
local _moddir
local _func
+ local _reason
_func=$1
for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
- [[ -d $_moddir ]] || continue
- [[ -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]}
$_func "$_mod" 1 "$_moddir"
&& [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
&& continue
- derror "dracut module '$_mod' cannot be found or installed."
+ [[ -d $(echo "$dracutbasedir/modules.d"/[0-9][0-9]"$_mod") ]] \
+ && _reason="installed" \
+ || _reason="found"
+ derror "Module '$_mod' cannot be $_reason."
[[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
[[ " $dracutmodules " == *\ $_mod\ * ]] && exit 1
[[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
# 1 if a virt environment could not be detected
# 255 if any error was encountered
if type -P systemd-detect-virt > /dev/null 2>&1; then
- if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
+ if ! vm=$(systemd-detect-virt --vm 2> /dev/null); then
return 255
fi
[[ $vm == "qemu" ]] && return 0