* 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
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
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
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
# 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
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
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
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
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
# 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