]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(network,dbus): improve dependency checking
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 2 Feb 2023 21:22:26 +0000 (21:22 +0000)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Fri, 9 Jun 2023 12:55:48 +0000 (08:55 -0400)
Decouple implementation details of the backend
dependencies from the meta module.

Call check_module for each submodule instead
of reimplementing sub-package dependencies
inside the meta module itself.

Add missing NetworkManager binary to the
network-manager dracut module check.

modules.d/09dbus/module-setup.sh
modules.d/35network-manager/module-setup.sh
modules.d/40network/module-setup.sh

index e3e1f16be609545cdb04c4eaabca9eec5b2fadfe..679483d3b8a26e498429d9f9d6f33516c110687a 100755 (executable)
@@ -19,7 +19,7 @@ depends() {
         fi
     done
 
-    if find_binary dbus-broker &> /dev/null; then
+    if check_module "dbus-broker"; then
         echo "dbus-broker"
         return 0
     else
index c5d568f0bc2922a3fe41068355cc98448cc088a9..d9a244a3f07689db10bdd594b9dfce97a411207b 100755 (executable)
@@ -2,7 +2,7 @@
 
 # called by dracut
 check() {
-    require_binaries sed grep || return 1
+    require_binaries sed grep NetworkManager || return 1
 
     # do not add this module by default
     return 255
index ba7104d9dfbd50220e21a6e5204f14d2d8cf83d7..4c77ff3292eec890ed03d667393bb9f0c5bcc004 100755 (executable)
@@ -17,11 +17,11 @@ depends() {
     done
 
     if [ -z "$network_handler" ]; then
-        if [[ -e $dracutsysrootdir$systemdsystemunitdir/connman.service ]]; then
+        if check_module "connman"; then
             network_handler="connman"
-        elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]] || [[ -x $dracutsysrootdir/usr/lib/nm-initrd-generator ]]; then
+        elif check_module "network-manager"; then
             network_handler="network-manager"
-        elif [[ -x $dracutsysrootdir$systemdutildir/systemd-networkd ]]; then
+        elif check_module "systemd-networkd"; then
             network_handler="systemd-networkd"
         else
             network_handler="network-legacy"