Bug#634649: os-prober does not detect Windows if there is a /boot folder in the Windows partition
On Sat, Jul 23, 2011 at 15:50, yannubuntu@gmail.com
<yannubuntu@gmail.com> wrote:
> 2011/7/23 Otavio Salvador <otavio@ossystems.com.br>
>> On Sat, Jul 23, 2011 at 15:09, yannubuntu@gmail.com
>> <yannubuntu@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.
>
> Fixed in my config. Obrigado Otavio !
Hello,
Talking with Colin at #debian-boot we found some possible corner cases
and then we end up doing some more changes. Please give this one a
final test so I can upload it.
--
Otavio Salvador O.S. Systems
E-mail: otavio@ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
diff --git a/os-probes/mounted/x86/20microsoft b/os-probes/mounted/x86/20microsoft
index cb574ec..71835b4 100755
--- a/os-probes/mounted/x86/20microsoft
+++ b/os-probes/mounted/x86/20microsoft
@@ -16,27 +16,40 @@ case "$type" in
*) debug "$1 is not a MS partition: exiting"; exit 1 ;;
esac
+found=
# 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 BOOT
+ for boot in "$(item_in_dir boot "$2")"; do
+ 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
+
+ found=true
+
+ break
+ fi
+ done
+fi
+
# 2000/XP/NT4.0
-elif item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then
+if [ -z "$found" ] && item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then
long="Windows NT/2000/XP"
short=Windows
ini=$(item_in_dir boot.ini "$2")
@@ -62,18 +75,26 @@ elif item_in_dir -q ntldr "$2" && item_in_dir -q ntdetect.com "$2"; then
else
long="Windows NT/2000/XP (loader)"
fi
+
+ found=true
fi
# MS-DOS
-elif item_in_dir -q dos "$2" &&
+elif [ -z "$found" ] && item_in_dir -q dos "$2" &&
[ -d "$2"/"$(item_in_dir dos "$2")" ]; then
long="MS-DOS 5.x/6.x/Win3.1"
short=MS-DOS
+
+ found=true
# 95/98/Me
-elif item_in_dir -q windows "$2" &&
+elif [ -z "$found" ] && item_in_dir -q windows "$2" &&
item_in_dir -q win.com "$2"/"$(item_in_dir windows "$2")"; then
long="Windows 95/98/Me"
short=Windows9xMe
-else
+
+ found=true
+fi
+
+if [ -z "$found" ]; then
exit 1
fi
Reply to: