Blame SOURCES/0510-Add-NTFS-support-to-90dmsquash-live-module.patch

5c6c2a
From 015d5aee92d461ce44d8b8cf941fb45855c13c3b Mon Sep 17 00:00:00 2001
5c6c2a
From: Robert Scheck <robert@fedoraproject.org>
5c6c2a
Date: Tue, 22 Aug 2017 23:44:41 +0200
5c6c2a
Subject: [PATCH] Add NTFS support to 90dmsquash-live module
5c6c2a
5c6c2a
Support booting from USB media with NTFS filesystem (optionally),
5c6c2a
which removes the FAT32 related 4 GB file size limit for LiveOS/
5c6c2a
squashfs.img (and any other file on the same USB media).
5c6c2a
5c6c2a
Backports 37437cac8a1f2c411ead5fca28fb743a6f36f912 from dracut 046
5c6c2a
---
5c6c2a
 modules.d/90dmsquash-live-ntfs/module-setup.sh  | 22 ++++++++++++++++++++++
5c6c2a
 modules.d/90dmsquash-live/dmsquash-live-root.sh | 15 ++++++++++++++-
5c6c2a
 2 files changed, 36 insertions(+), 1 deletion(-)
5c6c2a
 create mode 100755 modules.d/90dmsquash-live-ntfs/module-setup.sh
5c6c2a
5c6c2a
diff --git a/modules.d/90dmsquash-live-ntfs/module-setup.sh b/modules.d/90dmsquash-live-ntfs/module-setup.sh
5c6c2a
new file mode 100755
5c6c2a
index 00000000..bc77376b
5c6c2a
--- /dev/null
5c6c2a
+++ b/modules.d/90dmsquash-live-ntfs/module-setup.sh
5c6c2a
@@ -0,0 +1,22 @@
5c6c2a
+#!/bin/bash
5c6c2a
+
5c6c2a
+command -v
5c6c2a
+
5c6c2a
+check() {
5c6c2a
+    require_binaries ntfs-3g || return 1
5c6c2a
+    return 255
5c6c2a
+}
5c6c2a
+
5c6c2a
+depends() {
5c6c2a
+    echo 90dmsquash-live
5c6c2a
+    return 0
5c6c2a
+}
5c6c2a
+
5c6c2a
+install() {
5c6c2a
+    inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
5c6c2a
+    dracut_need_initqueue
5c6c2a
+}
5c6c2a
+
5c6c2a
+installkernel() {
5c6c2a
+    hostonly='' instmods fuse
5c6c2a
+}
5c6c2a
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
5c6c2a
index 6631d9a8..5fb798c7 100755
5c6c2a
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
5c6c2a
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
5c6c2a
@@ -79,7 +79,20 @@ if [ -f $livedev ]; then
5c6c2a
     esac
5c6c2a
     [ -e /sys/fs/$fstype ] || modprobe $fstype
5c6c2a
 else
5c6c2a
-    mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
5c6c2a
+    if [ "$(blkid -o value -s TYPE $livedev)" != "ntfs" ]; then
5c6c2a
+        mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
5c6c2a
+    else
5c6c2a
+        # Symlinking /usr/bin/ntfs-3g as /sbin/mount.ntfs seems to boot
5c6c2a
+        # at the first glance, but ends with lots and lots of squashfs
5c6c2a
+        # errors, because systemd attempts to kill the ntfs-3g process?!
5c6c2a
+        if [ -x "$(find_binary "ntfs-3g")" ]; then
5c6c2a
+            ( exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live ) | vwarn
5c6c2a
+        else
5c6c2a
+            die "Failed to mount block device of live image: Missing NTFS support"
5c6c2a
+            exit 1
5c6c2a
+        fi
5c6c2a
+    fi
5c6c2a
+
5c6c2a
     if [ "$?" != "0" ]; then
5c6c2a
         die "Failed to mount block device of live image"
5c6c2a
         exit 1