Blob Blame History Raw
From c08bc8109d4c43beacfa4bcdc20a356102da6d02 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 17 May 2021 11:00:22 +0200
Subject: [PATCH] fix(base): split out `dracut-dev-lib.sh`

To share the `wait_for_dev` function and use it without side effects on
install time, split out the needed functions in an extra library.
---
 modules.d/99base/dracut-dev-lib.sh | 119 +++++++++++++++++++++++++++++++++++++
 modules.d/99base/dracut-lib.sh     | 115 +----------------------------------
 modules.d/99base/module-setup.sh   |   9 ++-
 test/TEST-01-BASIC/test.sh         |   1 +
 test/TEST-02-SYSTEMD/test.sh       |   1 +
 test/TEST-03-USR-MOUNT/test.sh     |   1 +
 test/TEST-04-FULL-SYSTEMD/test.sh  |   1 +
 test/TEST-10-RAID/test.sh          |   1 +
 test/TEST-11-LVM/test.sh           |   1 +
 test/TEST-12-RAID-DEG/test.sh      |   1 +
 test/TEST-13-ENC-RAID-LVM/test.sh  |   1 +
 test/TEST-14-IMSM/test.sh          |   1 +
 test/TEST-15-BTRFSRAID/test.sh     |   1 +
 test/TEST-16-DMSQUASH/test.sh      |   1 +
 test/TEST-17-LVM-THIN/test.sh      |   1 +
 test/TEST-20-NFS/test.sh           |   1 +
 test/TEST-30-ISCSI/test.sh         |   1 +
 test/TEST-35-ISCSI-MULTI/test.sh   |   1 +
 test/TEST-40-NBD/test.sh           |   2 +
 test/TEST-50-MULTINIC/test.sh      |   1 +
 test/TEST-98-GETARG/test.sh        |   2 +
 21 files changed, 145 insertions(+), 118 deletions(-)

diff --git a/modules.d/99base/dracut-dev-lib.sh b/modules.d/99base/dracut-dev-lib.sh
new file mode 100755
index 00000000..5083f4f2
--- /dev/null
+++ b/modules.d/99base/dracut-dev-lib.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+# get a systemd-compatible unit name from a path
+# (mimicks unit_name_from_path_instance())
+dev_unit_name() {
+    local dev="$1"
+
+    if command -v systemd-escape > /dev/null; then
+        systemd-escape -p -- "$dev"
+        return $?
+    fi
+
+    if [ "$dev" = "/" -o -z "$dev" ]; then
+        printf -- "-"
+        return 0
+    fi
+
+    dev="${1%%/}"
+    dev="${dev##/}"
+    # shellcheck disable=SC1003
+    dev="$(str_replace "$dev" '\' '\x5c')"
+    dev="$(str_replace "$dev" '-' '\x2d')"
+    if [ "${dev##.}" != "$dev" ]; then
+        dev="\x2e${dev##.}"
+    fi
+    dev="$(str_replace "$dev" '/' '-')"
+
+    printf -- "%s" "$dev"
+}
+
+# set_systemd_timeout_for_dev [-n] <dev> [<timeout>]
+# Set 'rd.timeout' as the systemd timeout for <dev>
+set_systemd_timeout_for_dev() {
+    local _name
+    local _needreload
+    local _noreload
+    local _timeout
+
+    [ -z "$DRACUT_SYSTEMD" ] && return 0
+
+    if [ "$1" = "-n" ]; then
+        _noreload=1
+        shift
+    fi
+
+    if [ -n "$2" ]; then
+        _timeout="$2"
+    else
+        _timeout=$(getarg rd.timeout)
+    fi
+
+    _timeout=${_timeout:-0}
+
+    _name=$(dev_unit_name "$1")
+    if ! [ -L "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device" ]; then
+        [ -d "${PREFIX}"/etc/systemd/system/initrd.target.wants ] || mkdir -p "${PREFIX}"/etc/systemd/system/initrd.target.wants
+        ln -s ../"${_name}".device "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
+        type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/"${_name}".device
+        _needreload=1
+    fi
+
+    if ! [ -f "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf" ]; then
+        mkdir -p "${PREFIX}/etc/systemd/system/${_name}.device.d"
+        {
+            echo "[Unit]"
+            echo "JobTimeoutSec=$_timeout"
+            echo "JobRunningTimeoutSec=$_timeout"
+        } > "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
+        type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/"${_name}".device.d/timeout.conf
+        _needreload=1
+    fi
+
+    if [ -z "$PREFIX" ] && [ "$_needreload" = 1 ] && [ -z "$_noreload" ]; then
+        /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
+    fi
+}
+
+# wait_for_dev <dev> [<timeout>]
+#
+# Installs a initqueue-finished script,
+# which will cause the main loop only to exit,
+# if the device <dev> is recognized by the system.
+wait_for_dev() {
+    local _name
+    local _noreload
+
+    if [ "$1" = "-n" ]; then
+        _noreload=-n
+        shift
+    fi
+
+    _name="$(str_replace "$1" '/' '\x2f')"
+
+    type mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
+
+    [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
+
+    printf '[ -e "%s" ]\n' "$1" \
+        >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh"
+    {
+        printf '[ -e "%s" ] || ' "$1"
+        printf 'warn "\"%s\" does not exist"\n' "$1"
+    } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh"
+
+    set_systemd_timeout_for_dev $_noreload "$@"
+}
+
+cancel_wait_for_dev() {
+    local _name
+    _name="$(str_replace "$1" '/' '\x2f')"
+    rm -f -- "$hookdir/initqueue/finished/devexists-${_name}.sh"
+    rm -f -- "$hookdir/emergency/80-${_name}.sh"
+    if [ -n "$DRACUT_SYSTEMD" ]; then
+        _name=$(dev_unit_name "$1")
+        rm -f -- "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
+        rm -f -- "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
+        /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
+    fi
+}
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index c35658fa..dc94e93f 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+type wait_for_dev > /dev/null 2>&1 || . /lib/dracut-dev-lib.sh
+
 export DRACUT_SYSTEMD
 export NEWROOT
 if [ -n "$NEWROOT" ]; then
@@ -838,119 +840,6 @@ wait_for_mount() {
     } >> "$hookdir/emergency/90-${_name}.sh"
 }
 
-# get a systemd-compatible unit name from a path
-# (mimicks unit_name_from_path_instance())
-dev_unit_name() {
-    local dev="$1"
-
-    if command -v systemd-escape > /dev/null; then
-        systemd-escape -p -- "$dev"
-        return
-    fi
-
-    if [ "$dev" = "/" -o -z "$dev" ]; then
-        printf -- "-"
-        exit 0
-    fi
-
-    dev="${1%%/}"
-    dev="${dev##/}"
-    # shellcheck disable=SC1003
-    dev="$(str_replace "$dev" '\' '\x5c')"
-    dev="$(str_replace "$dev" '-' '\x2d')"
-    if [ "${dev##.}" != "$dev" ]; then
-        dev="\x2e${dev##.}"
-    fi
-    dev="$(str_replace "$dev" '/' '-')"
-
-    printf -- "%s" "$dev"
-}
-
-# set_systemd_timeout_for_dev <dev>
-# Set 'rd.timeout' as the systemd timeout for <dev>
-
-set_systemd_timeout_for_dev() {
-    local _name
-    local _needreload
-    local _noreload
-    local _timeout
-
-    if [ "$1" = "-n" ]; then
-        _noreload=1
-        shift
-    fi
-
-    _timeout=$(getarg rd.timeout)
-    _timeout=${_timeout:-0}
-
-    if [ -n "$DRACUT_SYSTEMD" ]; then
-        _name=$(dev_unit_name "$1")
-        if ! [ -L "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device" ]; then
-            [ -d "${PREFIX}"/etc/systemd/system/initrd.target.wants ] || mkdir -p "${PREFIX}"/etc/systemd/system/initrd.target.wants
-            ln -s ../"${_name}".device "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
-            type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/"${_name}".device
-            _needreload=1
-        fi
-
-        if ! [ -f "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf" ]; then
-            mkdir -p "${PREFIX}/etc/systemd/system/${_name}.device.d"
-            {
-                echo "[Unit]"
-                echo "JobTimeoutSec=$_timeout"
-                echo "JobRunningTimeoutSec=$_timeout"
-            } > "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
-            type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/"${_name}".device.d/timeout.conf
-            _needreload=1
-        fi
-
-        if [ -z "$PREFIX" ] && [ "$_needreload" = 1 ] && [ -z "$_noreload" ]; then
-            /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
-        fi
-    fi
-}
-# wait_for_dev <dev>
-#
-# Installs a initqueue-finished script,
-# which will cause the main loop only to exit,
-# if the device <dev> is recognized by the system.
-wait_for_dev() {
-    local _name
-    local _noreload
-
-    if [ "$1" = "-n" ]; then
-        _noreload=-n
-        shift
-    fi
-
-    _name="$(str_replace "$1" '/' '\x2f')"
-
-    type mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
-
-    [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
-
-    printf '[ -e "%s" ]\n' "$1" \
-        >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh"
-    {
-        printf '[ -e "%s" ] || ' "$1"
-        printf 'warn "\"%s\" does not exist"\n' "$1"
-    } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh"
-
-    set_systemd_timeout_for_dev $_noreload "$1"
-}
-
-cancel_wait_for_dev() {
-    local _name
-    _name="$(str_replace "$1" '/' '\x2f')"
-    rm -f -- "$hookdir/initqueue/finished/devexists-${_name}.sh"
-    rm -f -- "$hookdir/emergency/80-${_name}.sh"
-    if [ -n "$DRACUT_SYSTEMD" ]; then
-        _name=$(dev_unit_name "$1")
-        rm -f -- "${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device"
-        rm -f -- "${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf"
-        /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
-    fi
-}
-
 killproc() {
     debug_off
     local _exe
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index a52c643e..7eb0a277 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -50,6 +50,7 @@ install() {
     mkdir -p "${initdir}"/tmp
 
     inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
+    inst_simple "$moddir/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
     mkdir -p "${initdir}"/var
 
     if ! dracut_module_included "systemd"; then
@@ -117,10 +118,8 @@ install() {
                 fi
                 export PREFIX="$initdir"
 
-                # suppress getarg for `rd.memdebug`
-                export DEBUG_MEM_LEVEL=0
-                # shellcheck source=dracut-lib.sh
-                . "$moddir/dracut-lib.sh"
+                # shellcheck source=dracut-dev-lib.sh
+                . "$moddir/dracut-dev-lib.sh"
 
                 for _dev in "${host_devs[@]}"; do
                     for _dev2 in "${root_devs[@]}"; do
@@ -137,7 +136,7 @@ install() {
                     _pdev=$(get_persistent_dev "$_dev")
 
                     case "$_pdev" in
-                        /dev/?*) wait_for_dev "$_pdev" ;;
+                        /dev/?*) wait_for_dev "$_pdev" 0 ;;
                         *) ;;
                     esac
                 done
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 7ac2a8b9..012f2e5a 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -49,6 +49,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-02-SYSTEMD/test.sh b/test/TEST-02-SYSTEMD/test.sh
index a8185b09..8b6b5930 100755
--- a/test/TEST-02-SYSTEMD/test.sh
+++ b/test/TEST-02-SYSTEMD/test.sh
@@ -48,6 +48,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-03-USR-MOUNT/test.sh b/test/TEST-03-USR-MOUNT/test.sh
index 13361173..3bb7fab7 100755
--- a/test/TEST-03-USR-MOUNT/test.sh
+++ b/test/TEST-03-USR-MOUNT/test.sh
@@ -69,6 +69,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
index 9b8fab24..38cb1464 100755
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
@@ -93,6 +93,7 @@ test_setup() {
         inst_multiple -o {,/usr}/lib/systemd/system/"dracut*"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index f03d2952..918d2a71 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -46,6 +46,7 @@ test_setup() {
         inst_multiple -o ${_terminfodir}/l/linux
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index e44b21ff..12384c09 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -50,6 +50,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index 8d56f658..beb81381 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -80,6 +80,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index 2d76c982..968eafe7 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -78,6 +78,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index ab4f8119..78b087f5 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -75,6 +75,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-15-BTRFSRAID/test.sh b/test/TEST-15-BTRFSRAID/test.sh
index 75e97703..47edac81 100755
--- a/test/TEST-15-BTRFSRAID/test.sh
+++ b/test/TEST-15-BTRFSRAID/test.sh
@@ -53,6 +53,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
index 73c4c7f1..2a68f305 100755
--- a/test/TEST-16-DMSQUASH/test.sh
+++ b/test/TEST-16-DMSQUASH/test.sh
@@ -88,6 +88,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-17-LVM-THIN/test.sh b/test/TEST-17-LVM-THIN/test.sh
index 6f6886ec..7dbcca51 100755
--- a/test/TEST-17-LVM-THIN/test.sh
+++ b/test/TEST-17-LVM-THIN/test.sh
@@ -48,6 +48,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index dc9fa0b0..0be60a80 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -320,6 +320,7 @@ test_setup() {
         done
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index e1d10265..5f0063f8 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -162,6 +162,7 @@ test_setup() {
         inst_simple /etc/os-release
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-35-ISCSI-MULTI/test.sh b/test/TEST-35-ISCSI-MULTI/test.sh
index 09b939ab..628131e0 100755
--- a/test/TEST-35-ISCSI-MULTI/test.sh
+++ b/test/TEST-35-ISCSI-MULTI/test.sh
@@ -174,6 +174,7 @@ test_setup() {
         inst_simple /etc/os-release
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index df1bcb2f..178dff40 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -219,6 +219,7 @@ make_encrypted_root() {
         inst_multiple -o ${_terminfodir}/l/linux
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
@@ -299,6 +300,7 @@ make_client_root() {
         inst_multiple -o ${_terminfodir}/l/linux
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index e96cef7c..81b1f685 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -270,6 +270,7 @@ test_setup() {
         done
 
         inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
+        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
         inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
diff --git a/test/TEST-98-GETARG/test.sh b/test/TEST-98-GETARG/test.sh
index 9a00470b..012396ba 100755
--- a/test/TEST-98-GETARG/test.sh
+++ b/test/TEST-98-GETARG/test.sh
@@ -15,6 +15,7 @@ test_setup() {
     ln -sfnr "$basedir"/dracut-util "$TESTDIR"/dracut-getarg
     ln -sfnr "$basedir"/dracut-util "$TESTDIR"/dracut-getargs
     ln -sfnr "$basedir"/modules.d/99base/dracut-lib.sh "$TESTDIR"/dracut-lib.sh
+    ln -sfnr "$basedir"/modules.d/99base/dracut-dev-lib.sh "$TESTDIR"/dracut-dev-lib.sh
     return 0
 }
 
@@ -85,6 +86,7 @@ test_run() {
 
         export PATH=".:$PATH"
 
+        . dracut-dev-lib.sh
         . dracut-lib.sh
 
         debug_off() {