/usr/lib/xen-common/bin/xen-version is in xen-utils-common 4.1.4-3+deb7u9.
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 23 24 25 26 27 28 29 30 31 | #!/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_EXTRA="$(cat $DIR/extra)"
if [ "$VERSION_EXTRA" = "-unstable" ]; then
# Old xen-unstable
VERSION=unstable
elif [ "$VERSION_EXTRA" != "${VERSION_EXTRA#-}" ]; then
# ABI for Lenny and smaller
VERSION="$(cat $DIR/major).$(cat $DIR/minor)$VERSION_EXTRA"
else
VERSION="$(cat $DIR/major).$(cat $DIR/minor)"
fi
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"
|