#!/bin/sh -e

# don't run autodetection in guest
if grep -q [^0-] /sys/hypervisor/uuid 2>/dev/null; then
    VERSION=4.14
else
    VERSION=$(. /usr/lib/xen-common/bin/xen-version); RET=$?; [ $RET -eq 0 ] || exit $RET
fi

if [ -d "/usr/lib/xen-$VERSION" ]; then
    echo "/usr/lib/xen-$VERSION"
else
    echo "ERROR:  Can't find version $VERSION of xen utils, bailing out!" >&2
    exit 127
fi
