diff -Naur os-prober.orig/linux-boot-prober os-prober/linux-boot-prober --- os-prober.orig/linux-boot-prober 2006-06-19 12:57:44.000000000 +0200 +++ os-prober/linux-boot-prober 2006-06-20 00:18:08.000000000 +0200 @@ -2,12 +2,16 @@ . /usr/share/os-prober/common.sh set -e +if [ -n "$1" -a "$1" = "--mounted" ]; then + mounted="--mounted" + shift 1 +fi partition="$1" for test in /usr/lib/linux-boot-probes/*; do debug "running $test" if [ -x $test ] && [ -f $test ]; then - if $test $partition; then + if $test $mounted $partition; then debug "linux detected by $test" break fi diff -Naur os-prober.orig/linux-boot-probes/common/50mounted-tests os-prober/linux-boot-probes/common/50mounted-tests --- os-prober.orig/linux-boot-probes/common/50mounted-tests 2006-06-19 12:57:44.000000000 +0200 +++ os-prober/linux-boot-probes/common/50mounted-tests 2006-06-20 00:17:51.000000000 +0200 @@ -2,6 +2,10 @@ # Sub-tests that require a mounted partition. . /usr/share/os-prober/common.sh set -e +if [ -n "$1" -a "$1" = "--mounted" ]; then + mounted="--mounted" + shift 1 +fi partition=$1 parsefstab () { @@ -23,6 +27,11 @@ mkdir $tmpmnt fi +oldmnt=$(mount |grep "$partition "|cut -d' ' -f 3) +if [ -n "$mounted" -a -n "$oldmnt" ]; then + oldopts=$(mount |grep "$partition "|sed 's/.*(\(.*\)).*/\1/') + umount $partition +fi for type in $(grep -v nodev /proc/filesystems); do if mount -o ro -t $type $partition $tmpmnt 2>/dev/null; then bootpart="" @@ -87,6 +95,9 @@ debug "$test succeeded" umount $tmpmnt/boot 2>/dev/null || true umount $tmpmnt + if [ -n "$mounted" -a -n "$oldmnt" ]; then + mount $partition $oldmnt -o $oldopts + fi rmdir $tmpmnt || true exit 0 fi @@ -95,6 +106,9 @@ umount $tmpmnt/boot 2>/dev/null || true umount $tmpmnt + if [ -n "$mounted" -a -n "$oldmnt" ]; then + mount $partition $oldmnt -o $oldopts + fi break fi