#!/bin/sh # Detects Microsoft EFI-Loader on a collection of partitions. . /usr/share/os-prober/common.sh partition="$1" mpoint="$2" type="$3" # Weed out stuff that doesn't apply to us case "$type" in ntfs|ntfs-3g) debug "$1 is a NTFS partition" ;; vfat) debug "$1 is a FAT32 partition" ;; msdos) debug "$1 is a FAT16 partition" ;; 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 found= # Vista (previously Longhorn) if item_in_dir -q efi "$2"; then if [ ! -z "`find "$2" -type f -iname "bootmgfw.efi"`" ]; then mspath=$(find "$2" -type d -iname "microsoft") # there might be different boot directories in different case as: # boot Boot BOOT for boot in $(item_in_dir boot "$mspath"); do bcd=$(item_in_dir bcd "$mspath/$boot") if [ -n "$bcd" ]; then if grep -qs "W.i.n.d.o.w.s. .8" "$mspath/$boot/$bcd"; then long="Windows 8 (EFI loader)" elif grep -qs "W.i.n.d.o.w.s. .7" "$mspath/$boot/$bcd"; then long="Windows 7 (EFI loader)" elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$mspath/$boot/$bcd"; then long="Windows Vista (EFI loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$mspath/$boot/$bcd"; then long="Windows Server 2008 R2 (EFI loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$mspath/$boot/$bcd"; then long="Windows Server 2008 (EFI 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" "$mspath/$boot/$bcd"; then long="Windows Recovery Environment (EFI loader)" elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$mspath/$boot/$bcd"; then long="Windows Recovery Environment (EFI loader)" else long="Windows Vista (EFI loader)" fi short=Windows found=true break fi done fi fi if [ -z "$found" ]; then exit 1 fi label="$(count_next_label "$short")" result "${partition}:${long}:${label}:chain" # We want to allow other os-probes to probe the EFI-System-Partition: exit 1