[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#634649: os-prober does not detect Windows if there is a /boot folder in the Windows partition



On Sat, Jul 23, 2011 at 04:11, yannubuntu@gmail.com
<yannubuntu@gmail.com> wrote:
>>
>> I attached a new one and this is more verbose. Please test it.
>
> Bom dia Otavio

Bom dia! :-)

Well, I did a quite stupid mistake in last patch so I am attaching the
fixed one. I hope it works now.

-- 
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..79d0a43 100755
--- a/os-probes/mounted/x86/20microsoft
+++ b/os-probes/mounted/x86/20microsoft
@@ -1,6 +1,9 @@
 #!/bin/sh
 # Detects all Microsoft OSes on a collection of partitions.
 
+
+set -x
+
 . /usr/share/os-prober/common.sh
 
 partition="$1"
@@ -17,24 +20,34 @@ 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 "$2" "$(item_in_dir boot/ "$2")"; do
+		# drops the end slash
+		boot=${boot%/}
+
+		if 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
+
+			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"

Reply to: