Author: waldi Date: Wed Aug 23 11:40:23 2006 New Revision: 276 Modified: trunk/xen-common/scripts/xen-utils-root Log: scripts/xen-utils-root: Collect version from /sys/hypervisor. Modified: trunk/xen-common/scripts/xen-utils-root =============================================================================--- trunk/xen-common/scripts/xen-utils-root (original) +++ trunk/xen-common/scripts/xen-utils-root Wed Aug 23 11:40:23 2006 @@ -11,7 +11,18 @@ esac done -# TODO: real version detection +if [ -z "$VERSION" ]; then + if [ -d "/sys/hypervisor" ]; then + if [ "$(cat /sys/hypervisor/type)" = xen ]; then + dir=/sys/hypervisor/version/ + VERSION="$(cat $dir/major).$(cat $dir/minor)$(cat $dir/extra)" + else + [ "$QUIET" ] || echo "WARING! Can''t read type from sysfs!" >&2 + fi + else + [ "$QUIET" ] || echo "WARING! Can''t find hypervisor information in sysfs!" >&2 + fi +fi if [ -z "$VERSION" ]; then VERSION="default" @@ -32,4 +43,3 @@ [ "$QUIET" ] || echo "ERROR! Can''t find default version of xen utils, bailing out!" >&2 exit 1 -