#!/bin/sh -e

COMMAND="$(basename $0)"
TOOLSTACK=$(. /usr/lib/xen-common/bin/xen-toolstack); RET=$?; [ $RET -eq 0 ] || exit $RET

if [ "$(basename "$TOOLSTACK")" != "$COMMAND" ]; then
    echo "ERROR:  A different toolstack ($(basename "$TOOLSTACK")) have been selected!" >&2
    exit 1
fi

exec "$TOOLSTACK" "$@"
