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
return 0
}
+# helper function for check() in module-setup.sh
+# to check for required kernel modules
+# issues a standardized warning message
+require_kernel_modules() {
+ # shellcheck disable=SC2154
+ local _module_name="${moddir##*/}"
+ local _ret=0
+
+ # Ignore kernel module requirement for no-kernel build
+ [[ $no_kernel == yes ]] && return 0
+
+ if [[ $1 == "-m" ]]; then
+ _module_name="$2"
+ shift 2
+ fi
+
+ for mod in "$@"; do
+ if ! check_kernel_module "$mod" &> /dev/null; then
+ dinfo "Module '${_module_name#[0-9][0-9]}' will not be installed, because kernel module '$mod' is not available!"
+ ((_ret++))
+ fi
+ done
+ return "$_ret"
+}
+
dracut_need_initqueue() {
: > "$initdir/lib/dracut/need-initqueue"
}
}
# 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
build_ld_cache() {
for f in "$dracutsysrootdir"/etc/ld.so.conf "$dracutsysrootdir"/etc/ld.so.conf.d/*; do
- [[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
+ [[ -f $f ]] && inst_simple "${f#"$dracutsysrootdir"}"
done
if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
if [[ $EUID == 0 ]]; then
}
prepare_udev_rules() {
+ dwarn "prepare_udev_rules: deprecated and will be removed"
+
if [ -z "$UDEVVERSION" ]; then
UDEVVERSION=$(udevadm --version)
export UDEVVERSION
for _dir in $libdirs; do
for _i in "$@"; do
for _f in "$dracutsysrootdir$_dir"/$_i; do
- [[ ${_f#$dracutsysrootdir} =~ $_pattern ]] || continue
- [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
+ [[ ${_f#"$dracutsysrootdir"} =~ $_pattern ]] || continue
+ [[ -e $_f ]] && _files+=("${_f#"$dracutsysrootdir"}")
done
done
done
for _dir in $libdirs; do
for _i in "$@"; do
for _f in "$dracutsysrootdir$_dir"/$_i; do
- [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
+ [[ -e $_f ]] && _files+=("${_f#"$dracutsysrootdir"}")
done
done
done
&& 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
&& 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/install || -e $_moddir/installkernel || -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