]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
refactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Tue, 25 Oct 2022 17:54:34 +0000 (17:54 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 21 Dec 2022 14:30:48 +0000 (14:30 +0000)
Since the installation of ntfs-3g binary is in the
dmsquash-live-ntfs module, calling ntfs-3g from dmsquash-live fails
when dmsquash-live-ntfs module is not installed anyways.

modules.d/90dmsquash-live-ntfs/module-setup.sh
modules.d/90dmsquash-live-ntfs/mount-ntfs-3g.sh [new file with mode: 0755]
modules.d/90dmsquash-live/dmsquash-live-root.sh

index b5cfff58698596002a606c4a4726178cadd97cdd..7aa58027e3654704e2b998a8f4867df61de46080 100755 (executable)
@@ -12,6 +12,7 @@ depends() {
 
 install() {
     inst_multiple fusermount mount.fuse ntfs-3g
+    inst_script "$moddir/mount-ntfs-3g.sh" "/sbin/mount-ntfs-3g"
     dracut_need_initqueue
 }
 
diff --git a/modules.d/90dmsquash-live-ntfs/mount-ntfs-3g.sh b/modules.d/90dmsquash-live-ntfs/mount-ntfs-3g.sh
new file mode 100755 (executable)
index 0000000..289205c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+type vwarn > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+# Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
+# at the first glance, but ends with lots and lots of squashfs
+# errors, because systemd attempts to kill the ntfs-3g process?!
+# See https://systemd.io/ROOT_STORAGE_DAEMONS/
+if [ -x "/usr/bin/ntfs-3g" ]; then
+    (
+        ln -s /usr/bin/ntfs-3g /run/@ntfs-3g
+        (sleep 1 && rm /run/@ntfs-3g) &
+        # shellcheck disable=SC2123
+        PATH=/run
+        exec @ntfs-3g "$@"
+    ) | vwarn
+else
+    die "Failed to mount block device of live image: Missing NTFS support"
+    exit 1
+fi
index 17dfbc7331aac49b44578b7677516286a159e1e5..62d1b5e7cd200ea3479533c4ee49b97d6c58b675 100755 (executable)
@@ -120,22 +120,7 @@ else
             exit 1
         fi
     else
-        # Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
-        # at the first glance, but ends with lots and lots of squashfs
-        # errors, because systemd attempts to kill the ntfs-3g process?!
-        # See https://systemd.io/ROOT_STORAGE_DAEMONS/
-        if [ -x "/usr/bin/ntfs-3g" ]; then
-            (
-                ln -s /usr/bin/ntfs-3g /run/@ntfs-3g
-                (sleep 1 && rm /run/@ntfs-3g) &
-                # shellcheck disable=SC2123
-                PATH=/run
-                exec @ntfs-3g -o "${liverw:-ro}" "$livedev" /run/initramfs/live
-            ) | vwarn
-        else
-            die "Failed to mount block device of live image: Missing NTFS support"
-            exit 1
-        fi
+        [ -x "/sbin/mount-ntfs-3g" ] && /sbin/mount-ntfs-3g -o "${liverw:-ro}" "$livedev" /run/initramfs/live
     fi
 fi