]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Add NTFS support to 90dmsquash-live module (#191) 191/head
authorRobert Scheck <robert@fedoraproject.org>
Thu, 29 Jun 2017 22:15:57 +0000 (00:15 +0200)
committerRobert Scheck <robert@fedoraproject.org>
Thu, 29 Jun 2017 22:15:57 +0000 (00:15 +0200)
Support booting from USB media with NTFS filesystem (optionally),
which removes the FAT32 related 4 GB file size limit for LiveOS/
squashfs.img (and any other file on the same USB media).

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

diff --git a/modules.d/90dmsquash-live-ntfs/module-setup.sh b/modules.d/90dmsquash-live-ntfs/module-setup.sh
new file mode 100755 (executable)
index 0000000..bc77376
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+command -v
+
+check() {
+    require_binaries ntfs-3g || return 1
+    return 255
+}
+
+depends() {
+    echo 90dmsquash-live
+    return 0
+}
+
+install() {
+    inst_multiple fusermount ulockmgr_server mount.fuse ntfs-3g
+    dracut_need_initqueue
+}
+
+installkernel() {
+    hostonly='' instmods fuse
+}
index 3a25465c619486585eb1eb99be8eeb6dde04de69..723d7f01a141cf5dda722903eabd7010db699c62 100755 (executable)
@@ -78,7 +78,20 @@ if [ -f $livedev ]; then
     esac
     [ -e /sys/fs/$fstype ] || modprobe $fstype
 else
-    mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
+    if [ "$(blkid -o value -s TYPE $livedev)" != "ntfs" ]; then
+        mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
+    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?!
+        if [ -x "$(find_binary "ntfs-3g")" ]; then
+            ( exec -a @ntfs-3g 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
+    fi
+
     if [ "$?" != "0" ]; then
         die "Failed to mount block device of live image"
         exit 1