diff options
Diffstat (limited to 'sys-boot/os-prober/files/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch')
-rw-r--r-- | sys-boot/os-prober/files/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/sys-boot/os-prober/files/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch b/sys-boot/os-prober/files/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch new file mode 100644 index 00000000..42e22692 --- /dev/null +++ b/sys-boot/os-prober/files/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch @@ -0,0 +1,92 @@ +Index: os-prober-1.76/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.76.orig/os-probes/common/50mounted-tests ++++ os-prober-1.76/os-probes/common/50mounted-tests +@@ -49,19 +49,13 @@ elif [ -z "$types" ]; then + debug "$1 is a LUKS partition; skipping" + exit 0 + fi +- for type in $(grep -v nodev /proc/filesystems); do +- # hfsplus filesystems are mountable as hfs. Try hfs last so +- # that we can tell the difference. +- if [ "$type" = hfs ]; then +- delaytypes="${delaytypes:+$delaytypes }$type" +- elif [ "$type" = fuseblk ]; then +- if type ntfs-3g >/dev/null 2>&1; then +- types="${types:+$types }ntfs-3g" +- fi +- else +- types="${types:+$types }$type" +- fi +- done ++ ++ # Simply skip such partition is better than trying to detect ++ # it by blinded test mounts with all kinds of kernel file system, ++ # that would lead to unwanted consequence like kernel oops and ++ # risk to corrupt your system and data. ++ debug "$1 is a partition without file system; skipping" ++ exit 0 + fi + + tmpmnt=/var/lib/os-prober/mount +Index: os-prober-1.76/os-probes/init/common/10filesystems +=================================================================== +--- os-prober-1.76.orig/os-probes/init/common/10filesystems ++++ os-prober-1.76/os-probes/init/common/10filesystems +@@ -1,39 +1,19 @@ + #!/bin/sh + # Make sure filesystems are available. +-set +e # ignore errors from modprobe +- +-FILESYSTEMS='ext2 ext3 ext4 xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' +-# fuse is needed to make grub2-mount work. +-FILESYSTEMS="$FILESYSTEMS fuse" +-# The Ubuntu kernel udebs put a number of filesystem modules in +-# fs-{core,secondary}-modules. It's fairly cheap to check for these too. +-FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary" +- +-if [ ! -e /var/lib/os-prober/modules ]; then +- # Check for anna-install to make it easier to use os-prober outside +- # d-i. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- for fs in $FILESYSTEMS; do +- ANNA_QUIET=1 DEBIAN_FRONTEND=none \ +- log-output -t os-prober \ +- anna-install "$fs-modules" || true +- done +- depmod -a >/dev/null 2>&1 || true +- fi +- +- for fs in $FILESYSTEMS; do +- case "$fs" in +- fs-*) +- ;; +- *) +- modprobe "$fs" 2>/dev/null | logger -t os-prober +- ;; +- esac +- done +- +- # We only want to keep this state inside d-i, so this is as good a +- # check as any. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- touch /var/lib/os-prober/modules +- fi +-fi ++set -e ++ ++# Make sure fuse is available for grub2-mount ++# As long as we use grub2-mount, we use grub2's own file system modules ++# to mount the partitiion and the operation don't require kernel support ++# other than fuse. ++if ! cat /proc/filesystems | grep nodev | cut -f2 | grep -qw fuse; then ++ modprobe fuse 2>&1 | logger -t os-prober ++fi ++# Regarding file systems not supported by grub2, or systems simply don't ++# have grub2-mount, will use linux 'mount' utility. This will require ++# kernel file system module to work, but still we don't need to modprobe ++# all of them before mount, because mount() syscall will take care of it ++# by __request_module the needed kernel module and we should leave it do ++# that for us in order to have only needed modules get loaded. ++# ++# Still if you want any kernel module loaded, add them here. |