When using grub-mount, pass the GRUB filesystem type to individual tests rather than...
authorColin Watson <cjwatson@debian.org>
Thu, 15 Mar 2012 12:26:14 +0000 (12:26 +0000)
committerColin Watson <cjwatson@debian.org>
Thu, 15 Mar 2012 12:26:14 +0000 (12:26 +0000)
debian/changelog
linux-boot-probes/common/50mounted-tests
os-probes/common/50mounted-tests
os-probes/mounted/common/90bsd-distro
os-probes/mounted/powerpc/20macosx
os-probes/mounted/x86/10freedos
os-probes/mounted/x86/20microsoft
os-probes/mounted/x86/30utility
os-probes/mounted/x86/80minix
os-probes/mounted/x86/83haiku

index 78dfd5f..4b8faff 100644 (file)
@@ -15,6 +15,11 @@ os-prober (1.50) UNRELEASED; urgency=low
   * Avoid false positives in MS-DOS detection by also looking for
     autoexec.bat. Closes: #663540 
 
+  [ Colin Watson ]
+  * When using grub-mount, pass the GRUB filesystem type to individual tests
+    rather than "fuseblk".  Adjust a number of tests to handle GRUB
+    filesystem names as well as OS names (closes: #663540).
+
  -- Joey Hess <joeyh@debian.org>  Tue, 13 Dec 2011 17:54:33 -0400
 
 os-prober (1.49) unstable; urgency=low
index a17b48c..f812c2e 100755 (executable)
@@ -37,7 +37,8 @@ mounted=
 if which grub-mount >/dev/null 2>&1 && \
    grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
        mounted=1
-       type=fuseblk
+       type="$(grub-probe -d "$partition" -t fs)"
+       [ "$type" ] || type=fuseblk
 else
        ro_partition "$partition"
        for type in $types; do
index 9d878c0..214eca8 100755 (executable)
@@ -48,9 +48,14 @@ fi
 mounted=
 if which grub-mount >/dev/null 2>&1 && \
    grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
-       debug "mounted using GRUB"
        mounted=1
-       type=fuseblk
+       type="$(grub-probe -d "$partition" -t fs)"
+       if [ "$type" ]; then
+               debug "mounted using GRUB $type filesystem driver"
+       else
+               debug "mounted using GRUB, but unknown filesystem?"
+               type=fuseblk
+       fi
 else
        ro_partition "$partition"
        for type in $types $delaytypes; do
index b190aab..ddeeec7 100755 (executable)
@@ -8,35 +8,37 @@ partition="$1"
 dir="$2"
 type="$3"
 
-if [ "$type" = ufs ]; then
-  disk=$(echo $partition | gawk '{ match($0, /([[:alpha:][:punct:]]+)[[:digit:]]+/, disk); print disk[1] }')
+# Weed out stuff that doesn't apply to us
+case "$type" in
+  ufs|ufs1|ufs2) ;;
+  *) exit 1 ;;
+esac
 
-  if [ ! -z "$disk" ]; then
-    tpartition=$(echo $partition | sed 's|\/|\\/|g')
+disk=$(echo $partition | gawk '{ match($0, /([[:alpha:][:punct:]]+)[[:digit:]]+/, disk); print disk[1] }')
 
-    system=$(fdisk -l $disk | awk '/'$tpartition'[[:blank:]]+\*[[:blank:]]+.+[[:blank:]]+.+BSD/ {print $7}')
+if [ ! -z "$disk" ]; then
+  tpartition=$(echo $partition | sed 's|\/|\\/|g')
 
-    if [ ! -z "$system" ]; then
-      title=
+  system=$(fdisk -l $disk | awk '/'$tpartition'[[:blank:]]+\*[[:blank:]]+.+[[:blank:]]+.+BSD/ {print $7}')
 
-      if [ -f $dir/etc/motd ]; then
-        case $system in
-        FreeBSD | NetBSD | OpenBSD) title=$(cat $dir/etc/motd | gawk '{ match($0, /('$system')[[:blank:]]+([[:graph:]]+)[[:blank:]]+(\([[:print:]]+\))/, title); print title[1], title[2], title[3]; exit 0}')
-                                    ;;
-        esac
-      fi
+  if [ ! -z "$system" ]; then
+    title=
 
-      if [ -z "$title" ]; then
-        title="$system"
-      fi
-
-      label="$(count_next_label "$system")"
-      echo "$partition:$title:$label:chain"
+    if [ -f $dir/etc/motd ]; then
+      case $system in
+      FreeBSD | NetBSD | OpenBSD) title=$(cat $dir/etc/motd | gawk '{ match($0, /('$system')[[:blank:]]+([[:graph:]]+)[[:blank:]]+(\([[:print:]]+\))/, title); print title[1], title[2], title[3]; exit 0}')
+                                 ;;
+      esac
+    fi
 
-      exit 0
-    else
-      exit 1
+    if [ -z "$title" ]; then
+      title="$system"
     fi
+
+    label="$(count_next_label "$system")"
+    echo "$partition:$title:$label:chain"
+
+    exit 0
   else
     exit 1
   fi
index 5c12b74..dd4207f 100755 (executable)
@@ -13,7 +13,6 @@ debug() {
 # Weed out stuff that doesn't apply to us
 case "$type" in
   hfsplus) debug "$1 is an HFS+ partition" ;;
-  fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be GRUB
   *) debug "$1 is not an HFS+ partition: exiting"; exit 1 ;;
 esac
 
index 65117aa..94388f3 100755 (executable)
@@ -10,7 +10,7 @@ type="$3"
 case "$type" in
        vfat) debug "$1 is a FAT32 partition" ;;
        msdos) debug "$1 is a FAT16 partition" ;;
-       fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be GRUB
+       fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
        *) debug "$1 is not a FAT partition: exiting"; exit 1 ;;
 esac
 
index f491e86..db6c6f5 100755 (executable)
@@ -12,7 +12,8 @@ case "$type" in
        ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;;
        vfat) debug "$1 is a FAT32 partition" ;;
        msdos) debug "$1 is a FAT16 partition" ;;
-       fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be ntfs-3g/GRUB
+       fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
+       fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be ntfs-3g
        *) debug "$1 is not a MS partition: exiting"; exit 1 ;;
 esac
 
index 5044adb..af48d30 100755 (executable)
@@ -11,7 +11,7 @@ type="$3"
 case "$type" in
        vfat)   debug "$1 is a FAT32 partition" ;;
        msdos)  debug "$1 is a FAT16 partition" ;;
-       fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be GRUB
+       fat)    debug "$1 is a FAT partition (mounted by GRUB)" ;;
        *)      debug "$1 is not a FAT partition: exiting"; exit 1 ;;
 esac
 
index 6ad99d5..e01f669 100755 (executable)
@@ -7,20 +7,22 @@ partition="$1"
 dir="$2"
 type="$3"
 
-if [ "$type" = minix ] || [ "$type" = ext2 ] ; then
-       if [ -f "$dir/minix" ] || [ -e "$dir/boot/image_big" ]; then
-               if [ -e "$dir/boot/image_latest" ]; then
-                       boot="minix"
-               else
-                       boot="chain"
-               fi
+# Weed out stuff that doesn't apply to us
+case "$type" in
+       minix|minix2|ext2) ;;
+       *) exit 1 ;;
+esac
 
-               label="$(count_next_label Minix)"
-               result "$partition:Minix:$label:$boot"
-               exit 0
+if [ -f "$dir/minix" ] || [ -e "$dir/boot/image_big" ]; then
+       if [ -e "$dir/boot/image_latest" ]; then
+               boot="minix"
        else
-               exit 1
+               boot="chain"
        fi
+
+       label="$(count_next_label Minix)"
+       result "$partition:Minix:$label:$boot"
+       exit 0
 else
        exit 1
 fi
index addd9a4..b88528c 100755 (executable)
@@ -9,8 +9,7 @@ type="$3"
 
 # Weed out stuff that doesn't apply to us
 case "$type" in
-       befs) debug "$partition is a BeFS partition" ;;
-       fuse|fuseblk) debug "$1 is a FUSE partition" ;; # might be GRUB
+       befs|befs_be) debug "$partition is a BeFS partition" ;;
        *) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
 esac