fix: revise all module checks

1. no module checks for modules which are in depends()
2. no `derror` for optional (255) modules checking for dependencies
3. fix dbus meta module
master
Harald Hoyer 2021-02-09 16:24:59 +01:00 committed by Harald Hoyer
parent 1914a2eba1
commit 16efdfa25c
12 changed files with 22 additions and 95 deletions

View File

@ -10,23 +10,6 @@ check() {
require_binaries coredumpctl || return 1
require_binaries $systemdutildir/systemd-coredump || return 1

# If the module dependency requirements are not fulfilled
# return 1 to not include the required module(s).
if ! dracut_module_included "systemd"; then
derror "systemd-coredump needs systemd in the initramfs."
return 1
fi

if ! dracut_module_included "systemd-journald"; then
derror "systemd-coredump needs systemd-journald in the initramfs."
return 1
fi

if ! dracut_module_included "systemd-sysctl"; then
derror "systemd-coredump needs systemd-sysctl in the initramfs."
return 1
fi

# Return 255 to only include the module, if another module requires it.
return 255


View File

@ -4,11 +4,6 @@
check() {
[[ $mount_needs ]] && return 1

if ! dracut_module_included "systemd"; then
derror "systemd-initrd needs systemd in the initramfs"
return 1
fi

return 0
}


View File

@ -9,13 +9,6 @@ check() {
# return 1 to not include the binary.
require_binaries systemd-repart || return 1

# If the module dependency requirements are not fulfilled
# return 1 to not include the required module(s).
if ! dracut_module_included "systemd"; then
derror "systemd-repart needs systemd in the initramfs."
return 1
fi

# Return 255 to only include the module, if another module requires it.
return 255


View File

@ -9,13 +9,6 @@ check() {
# return 1 to not include the binary.
require_binaries systemd-sysusers || return 1

# If the module dependency requirements are not fulfilled
# return 1 to not include the required module(s).
if ! dracut_module_included "systemd"; then
derror "systemd-sysuser needs systemd in the initramfs."
return 1
fi

# Return 255 to only include the module, if another module requires it.
return 255


View File

@ -4,11 +4,6 @@
check() {
[[ $mount_needs ]] && return 1

if ! dracut_module_included "systemd"; then
derror "systemd-networkd needs systemd in the initramfs"
return 1
fi

return 255
}


View File

@ -11,25 +11,6 @@ check() {
require_binaries dbus-broker || return 1
require_binaries dbus-broker-launch || return 1

# If the module dependency requirements are not fulfilled
# return 1 to not include the required module(s).
if ! dracut_module_included "systemd"; then
derror "dbus-broker needs systemd in the initramfs."
return 1
fi

if ! dracut_module_included "systemd-sysusers"; then
derror "dbus-broker needs systemd-sysusers in the initramfs."
return 1
fi

# dbus-broker conflicts with dbus.

if dracut_module_included "dbus"; then
derror "dbus-broker conflicts with dbus in the initramfs."
exit 1
fi

# Return 255 to only include the module, if another module requires it.
return 255

@ -37,7 +18,6 @@ check() {

# Module dependency requirements.
depends() {

# This module has external dependency on the systemd module.
echo systemd systemd-sysusers
# Return 0 to include the dependent systemd module in the initramfs.

View File

@ -11,13 +11,6 @@ check() {
require_binaries dbus-daemon || return 1
require_binaries dbus-send || return 1

# If the module dependency requirements are not fulfilled
# return 1 to not include the required module(s).
if ! dracut_module_included "systemd"; then
derror "dbus needs systemd in the initramfs."
return 1
fi

# dbus conflicts with dbus-broker.
if dracut_module_included "dbus-broker"; then
derror "dbus conflicts with dbus-broker in the initramfs."

View File

@ -18,11 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

depends() {
echo systemd
return 0
}

check() {
# if there's no rngd binary, no go.
require_binaries rngd || return 1
@ -30,6 +25,11 @@ check() {
return 0
}

depends() {
echo systemd
return 0
}

install() {
inst rngd
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"

View File

@ -10,14 +10,22 @@ check() {

# Module dependency requirements.
depends() {
local _module
# Add a dbus meta dependency based on the module in use.
for module in dbus-daemon dbus-broker; do
if dracut_module_included "$module" ; then
dbus="$module"
break
for _module in dbus-daemon dbus-broker; do
if dracut_module_included "$_module" ; then
echo "$_module"
return 0
fi
done;

echo "$dbus"
return 0
if find_binary dbus-broker &> /dev/null ; then
echo "dbus-broker"
return 0
else
echo "dbus-daemon"
return 0
fi

return 1
}

View File

@ -17,7 +17,7 @@ depends() {
done;

if [ -z "$network_handler" ]; then
if require_binaries wicked; then
if find_binary wicked &>/dev/null ; then
network_handler="network-wicked"
elif [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ]; then
network_handler="network-manager"

View File

@ -4,11 +4,6 @@
check() {
[[ $mount_needs ]] && return 1

if ! dracut_module_included "systemd-initrd"; then
derror "dracut-systemd needs systemd-initrd in the initramfs"
return 1
fi

return 0
}


View File

@ -1,19 +1,11 @@
#!/bin/bash

check() {
if ! dracut_module_included "systemd-initrd"; then
derror "dracut-squash only supports systemd bases initramfs"
return 1
fi

if ! find_binary mksquashfs >/dev/null || ! find_binary unsquashfs >/dev/null ; then
derror "dracut-squash module requires squashfs-tools"
return 1
fi
require_binaries mksquashfs unsquashfs || return 1

for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS ; do
if ! check_kernel_config $i; then
derror "dracut-squash module requires kernel configuration $i (y or m)"
dinfo "dracut-squash module requires kernel configuration $i (y or m)"
return 1
fi
done