]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
99squash: improve pre-requirements check
authorKairui Song <kasong@redhat.com>
Mon, 8 Jun 2020 09:00:00 +0000 (17:00 +0800)
committerDaniel Molkentin <daniel@molkentin.de>
Tue, 4 Aug 2020 12:24:53 +0000 (14:24 +0200)
Check for systemd-initrd and squashfs-tools in check() to fail early if
it won't work.

Signed-off-by: Kairui Song <kasong@redhat.com>
modules.d/99squash/module-setup.sh

index 72fa81f07ca810901d3fd98af608fc3b80ae1b7c..6307377c9f40fb55dedef0e9fd44f9da1e94ea9f 100644 (file)
@@ -1,11 +1,21 @@
 #!/bin/bash
 
 check() {
+    if ! dracut_module_included "systemd-initrd"; then
+        derror "dracut-squash only supports systemd bases initramfs"
+        return 1
+    fi
+
+    if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
+        derror "dracut-squash module requires squashfs-tools"
+        return 1
+    fi
+
     return 255
 }
 
 depends() {
-    echo "bash systemd systemd-initrd"
+    echo "bash systemd-initrd"
     return 0
 }
 
@@ -14,11 +24,6 @@ installkernel() {
 }
 
 install() {
-    if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
-        derror "squash module requires squashfs-tools to be installed."
-        return 1
-    fi
-
     inst_multiple kmod modprobe mount mkdir ln echo
     inst $moddir/setup-squash.sh /squash/setup-squash.sh
     inst $moddir/clear-squash.sh /squash/clear-squash.sh