source: client/shared/lib/os-probes/mounted/05efi @ 1d1e06d

Last change on this file since 1d1e06d was 2cd8344, checked in by adv <adv@…>, 8 years ago

#796 os-probes librerias de grub con detección de nuevas versiones de sistemas opertativos (p.e win10). usado solo para ogLives antiguos (kernel 3.2)

git-svn-id: https://opengnsys.es/svn/branches/version1.1@5378 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 1.9 KB
RevLine 
[2cd8344]1#!/bin/sh
2# Detects all Microsoft OSes on a collection of partitions.
3
4. /usr/share/os-prober/common.sh
5
6partition="$1"
7mpoint="$2"
8type="$3"
9
10# This file is for UEFI platform only
11if [ ! -d /sys/firmware/efi ] || [ -f /var/lib/partman/ignore_uefi ]; then
12        debug "Not on UEFI platform"
13        exit 1
14fi
15
16# Weed out stuff that doesn't apply to us
17case "$type" in
18        vfat) debug "$1 is a FAT32 partition" ;;
19        msdos) debug "$1 is a FAT16 partition" ;;
20        fat) debug "$1 is a FAT partition (mounted by GRUB)" ;;
21        *) debug "$1 is $type partition: exiting"; exit 1 ;;
22esac
23
24if type udevadm > /dev/null 2>&1; then
25        udevinfo () {
26                udevadm info "$@"
27        }
28fi
29
30if type udevinfo > /dev/null 2>&1; then
31        # Skip virtual devices
32        if udevinfo -q path -n $partition | grep -q /virtual/; then
33                debug "$1 is virtual device: exiting"
34                exit 1
35        fi
36
37        eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
38        debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
39        debug "$partition partition type is $ID_PART_ENTRY_TYPE"
40
41        if [ -z "$ID_PART_ENTRY_TYPE" -o -z "$ID_PART_ENTRY_SCHEME" -o \
42                \( "$ID_PART_ENTRY_SCHEME" != gpt -a "$ID_PART_ENTRY_SCHEME" != msdos \) -o \
43                \( "$ID_PART_ENTRY_SCHEME" = gpt -a "$ID_PART_ENTRY_TYPE" != c12a7328-f81f-11d2-ba4b-00a0c93ec93b \) -o \
44                \( "$ID_PART_ENTRY_SCHEME" = msdos -a "$ID_PART_ENTRY_TYPE" != 0xef \) ]; then
45                debug "$partition is not a ESP partition: exiting"
46                exit 1
47        fi
48else
49        debug "udevinfo and udevadm missing - cannot check partition type"
50fi
51
52efi=$(item_in_dir efi "$mpoint")
53if [ -z "$efi" ]; then
54        debug "$mpoint does not have /EFI directory: exiting"
55        exit 1
56fi
57
58ret=1
59for test in /usr/lib/os-probes/mounted/efi/*; do
60        debug "running subtest $test"
61        if [ -f "$test" ] && [ -x "$test" ]; then
62                entry=$("$test" "$mpoint/$efi")
63                if [ -n "$entry" ]; then
64                        debug "bootloader $entry found by subtest $test"
65                        ret=0
66                        result "${partition}@/$efi/${entry}:efi"
67                fi
68        fi
69done
70
71exit $ret
Note: See TracBrowser for help on using the repository browser.