From 37437cac8a1f2c411ead5fca28fb743a6f36f912 Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Fri, 30 Jun 2017 00:15:57 +0200 Subject: [PATCH] Add NTFS support to 90dmsquash-live module (#191) 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). --- .../90dmsquash-live-ntfs/module-setup.sh | 22 +++++++++++++++++++ .../90dmsquash-live/dmsquash-live-root.sh | 15 ++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 modules.d/90dmsquash-live-ntfs/module-setup.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 index 000000000..bc77376b2 --- /dev/null +++ b/modules.d/90dmsquash-live-ntfs/module-setup.sh @@ -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 +} diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 3a25465c6..723d7f01a 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -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 -- 2.47.2