summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ds-identify39
1 files changed, 26 insertions, 13 deletions
diff --git a/tools/ds-identify b/tools/ds-identify
index e16708f6..0305e361 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -766,10 +766,34 @@ is_cdrom_ovf() {
config-2|CONFIG-2|rd_rdfe_stable*|cidata|CIDATA) return 1;;
esac
+ # skip device which size is 10MB or larger
+ local size="" sfile="${PATH_SYS_CLASS_BLOCK}/${dev##*/}/size"
+ [ -f "$sfile" ] || return 1
+ read size <"$sfile" || { warn "failed reading from $sfile"; return 1; }
+ # size is in 512 byte units. so convert to MB (integer division)
+ if [ $((size/2048)) -ge 10 ]; then
+ debug 2 "$dev: size $((size/2048))MB is considered too large for OVF"
+ return 1
+ fi
+
local idstr="http://schemas.dmtf.org/ovf/environment/1"
grep --quiet --ignore-case "$idstr" "${PATH_ROOT}$dev"
}
+has_ovf_cdrom() {
+ # DI_ISO9660_DEVS is <device>=label,<device>=label2
+ # like /dev/sr0=OVF-TRANSPORT,/dev/other=with spaces
+ if [ "${DI_ISO9660_DEVS#${UNAVAILABLE}:}" = "${DI_ISO9660_DEVS}" ]; then
+ local oifs="$IFS"
+ # shellcheck disable=2086
+ { IFS=","; set -- ${DI_ISO9660_DEVS}; IFS="$oifs"; }
+ for tok in "$@"; do
+ is_cdrom_ovf "${tok%%=*}" "${tok#*=}" && return 0
+ done
+ fi
+ return 1
+}
+
dscheck_OVF() {
check_seed_dir ovf ovf-env.xml && return "${DS_FOUND}"
@@ -780,20 +804,9 @@ dscheck_OVF() {
ovf_vmware_transport_guestinfo && return "${DS_FOUND}"
- # DI_ISO9660_DEVS is <device>=label,<device>=label2
- # like /dev/sr0=OVF-TRANSPORT,/dev/other=with spaces
- if [ "${DI_ISO9660_DEVS#${UNAVAILABLE}:}" = "${DI_ISO9660_DEVS}" ]; then
- local oifs="$IFS"
- # shellcheck disable=2086
- { IFS=","; set -- ${DI_ISO9660_DEVS}; IFS="$oifs"; }
- for tok in "$@"; do
- is_cdrom_ovf "${tok%%=*}" "${tok#*=}" && return $DS_FOUND
- done
- fi
+ has_ovf_cdrom && return "${DS_FOUND}"
- if ovf_vmware_guest_customization; then
- return ${DS_FOUND}
- fi
+ ovf_vmware_guest_customization && return "${DS_FOUND}"
return ${DS_NOT_FOUND}
}