On Sat, Jul 23, 2011 at 15:09, yannubu...@gmail.com <yannubu...@gmail.com> wrote: >> I maked a fake environment and tested this patch locally and it seems >> to work. Please give it a try and tell me. > > > Sorry, in both cases (with or without /boot folder), I get this output: > > $ LANG=C sudo os-prober > /dev/sda1:::chain > /dev/sda5:Ubuntu 10.10 (10.10):Ubuntu:linux
So now it has detected it but failed to handle description; the attached patch ought to fix it. -- Otavio Salvador O.S. Systems E-mail: ota...@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
From 5d7b29a71581e42f258405183cdbe48c8a60dda5 Mon Sep 17 00:00:00 2001 From: Otavio Salvador <ota...@ossystems.com.br> Date: Sat, 23 Jul 2011 14:44:10 +0200 Subject: [PATCH] Fix Windows detection when there are more then one boot directories --- debian/changelog | 2 + os-probes/mounted/x86/20microsoft | 47 ++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index 03c7c4f..191d6f1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ os-prober (1.48) UNRELEASED; urgency=low [ Otavio Salvador ] * add MeeGo detection support; thanks to Chengwei Yang <chengwei.y...@intel.com> for the patch. + * Fix Windows detection when there are more then one boot directories + (e.g boot and Boot). Closes: #634649. -- Colin Watson <cjwat...@debian.org> Thu, 16 Jun 2011 22:51:13 +0100 diff --git a/os-probes/mounted/x86/20microsoft b/os-probes/mounted/x86/20microsoft index cb574ec..4c9a6e3 100755 --- a/os-probes/mounted/x86/20microsoft +++ b/os-probes/mounted/x86/20microsoft @@ -17,24 +17,35 @@ case "$type" in esac # Vista (previously Longhorn) -if item_in_dir -q bootmgr "$2" && boot="$(item_in_dir boot "$2")" && - bcd="$(item_in_dir bcd "$2/$boot")"; then - if grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then - long="Windows 7 (loader)" - elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then - long="Windows Vista (loader)" - elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then - long="Windows Server 2008 R2 (loader)" - elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then - long="Windows Server 2008 (loader)" - elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then - long="Windows Recovery Environment (loader)" - elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then - long="Windows Recovery Environment (loader)" - else - long="Windows Vista (loader)" - fi - short=Windows +if item_in_dir -q bootmgr "$2"; then + # there might be different boot directories in different case as: + # boot/ Boot/ + for boot in "$(item_in_dir boot/ "$2")"; do + # drops the end slash + boot=${boot%/} + + bcd=$(item_in_dir bcd "$2/$boot") + if [ -n "$bcd"]; then + if grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then + long="Windows 7 (loader)" + elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then + long="Windows Vista (loader)" + elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then + long="Windows Server 2008 R2 (loader)" + elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then + long="Windows Server 2008 (loader)" + elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then + long="Windows Recovery Environment (loader)" + elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then + long="Windows Recovery Environment (loader)" + else + long="Windows Vista (loader)" + fi + short=Windows + + break + fi + done # 2000/XP/NT4.0 elif item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then long="Windows NT/2000/XP" -- 1.7.5.4