Ubuntu Pastebin

Paste from smoser at Tue, 12 Dec 2017 19:57:18 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
is_cdrom_ovf() {
    local dev="$1" label="$2"
    # skip devices that don't look like cdrom paths.
    case "$dev" in
        /dev/sr[0-9]|/dev/hd[a-z]) :;;
        *) debug 1 "skipping iso dev $dev"
           return 1;;
    esac

    # fast path known 'OVF' labels
    [ "$label" = "OVF-TRANSPORT" -o "$label" = "ovf-transport" ] && return 0

    # explicitly skip known labels of other types. rd_rdfe is azure.
    case "$label" in
        config-2|rd_rdfe_stable*|cidata) return 1;;
    esac

    local idstr="http://schemas.dmtf.org/ovf/environment/1"
    grep --quiet --ignore-case "$idstr" "${PATH_ROOT}$dev"
}

dscheck_OVF() {
    check_seed_dir ovf ovf-env.xml && return "${DS_FOUND}"

    [ "${DI_VIRT}" = "none" ] && return ${DS_NOT_FOUND}

    # Azure provides ovf. Skip false positive by dis-allowing.
    is_azure_chassis && return $DS_NOT_FOUND

    local isodevs="${DI_ISO9660_DEVS}"
    case "$isodevs" in
        ""|$UNAVAILABLE:*) return ${DS_NOT_FOUND};;
    esac

    # DI_ISO9660_DEVS is <device>=label, like /dev/sr0=OVF-TRANSPORT
    for tok in $isodevs; do
        is_cdrom_ovf "${tok%%=*}" "${tok#*=}" && return $DS_FOUND
    done

    if ovf_vmware_guest_customization; then
        return ${DS_FOUND}
    fi

    return ${DS_NOT_FOUND}
}
Download as text