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

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