/usr/lib/xen-common/bin/xen-version is in xen-utils-common 4.4.0-0ubuntu5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/bin/sh -e
error() {
echo "ERROR: " "$@" >&2
exit 1
}
if [ -e "/sys/hypervisor/type" ]; then
type="$(cat /sys/hypervisor/type)"
if [ "$type" = xen ]; then
DIR=/sys/hypervisor/version
VERSION="$(cat $DIR/major).$(cat $DIR/minor)"
elif [ -z "$type" ]; then
error "Can't read hypervisor type from sysfs!"
else
error "Hypervisor is not xen but '$type'!"
fi
else
error "Can't find hypervisor information in sysfs!"
fi
echo "$VERSION"
|