From: Laszlo Gombos Date: Tue, 25 Oct 2022 17:54:34 +0000 (+0000) Subject: refactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs X-Git-Tag: 058~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31938c59801144c62f7e4b1ab3500ac41424c9a6;p=thirdparty%2Fdracut.git refactor(dmsquash-live): move ntfs-3g code to dmsquash-live-ntfs 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. --- diff --git a/modules.d/90dmsquash-live-ntfs/module-setup.sh b/modules.d/90dmsquash-live-ntfs/module-setup.sh index b5cfff586..7aa58027e 100755 --- a/modules.d/90dmsquash-live-ntfs/module-setup.sh +++ b/modules.d/90dmsquash-live-ntfs/module-setup.sh @@ -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 index 000000000..289205c3c --- /dev/null +++ b/modules.d/90dmsquash-live-ntfs/mount-ntfs-3g.sh @@ -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 diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 17dfbc733..62d1b5e7c 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -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