Bastian Blank
2009-Nov-18 12:52 UTC
[Pkg-xen-changes] r686 - in trunk/xen-common: debian scripts
Author: waldi Date: Wed Nov 18 12:52:37 2009 New Revision: 686 Log: * debian/changelog: Update. * debian/xen-utils-common.xend.init, debian/xen-utils-common.xendomains.init: Call xen-utils-version without parameters. * scripts/xen-utils-version: Only detect version. * scripts/xen-utils-wrapper: Move directory detection. Modified: trunk/xen-common/debian/changelog trunk/xen-common/debian/xen-utils-common.xend.init trunk/xen-common/debian/xen-utils-common.xendomains.init trunk/xen-common/scripts/xen-utils-version trunk/xen-common/scripts/xen-utils-wrapper Modified: trunk/xen-common/debian/changelog =============================================================================--- trunk/xen-common/debian/changelog Mon Nov 16 19:57:24 2009 (r685) +++ trunk/xen-common/debian/changelog Wed Nov 18 12:52:37 2009 (r686) @@ -1,3 +1,10 @@ +xen-common (3.4.2-2) UNRELEASED; urgency=low + + * Redefine Xen version tests to allow detection of bare metal. + (closes: #556859) + + -- Bastian Blank <waldi at debian.org> Wed, 18 Nov 2009 13:45:26 +0100 + xen-common (3.4.2-1) unstable; urgency=low * New upstream version. @@ -29,7 +36,7 @@ * Fix init script LSB headers (closes: #458502) [ Bastian Blank ] - * Special case unstable versions. + * Special case unstable versions. -- Bastian Blank <waldi at debian.org> Fri, 07 Mar 2008 14:19:47 +0100 Modified: trunk/xen-common/debian/xen-utils-common.xend.init =============================================================================--- trunk/xen-common/debian/xen-utils-common.xend.init Mon Nov 16 19:57:24 2009 (r685) +++ trunk/xen-common/debian/xen-utils-common.xend.init Wed Nov 18 12:52:37 2009 (r686) @@ -12,7 +12,7 @@ PATH=/usr/lib/xen-common/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Xen daemons" -VERSION=$(xen-utils-version -q 2>/dev/null || true) +VERSION=$(xen-utils-version) ROOT=/usr/lib/xen-$VERSION XEND="$ROOT"/bin/xend @@ -22,8 +22,8 @@ XENSTORED_DIR="/var/run/xenstored" XENSTORED_PIDFILE="/var/run/xenstore.pid" -test "$VERSION" || exit 0 -test -x "$XEND" || exit 0 +[ "$VERSION" ] || exit 0 +[ -x "$XEND" ] || exit 0 [ -r /etc/default/xend ] && . /etc/default/xend Modified: trunk/xen-common/debian/xen-utils-common.xendomains.init =============================================================================--- trunk/xen-common/debian/xen-utils-common.xendomains.init Mon Nov 16 19:57:24 2009 (r685) +++ trunk/xen-common/debian/xen-utils-common.xendomains.init Wed Nov 18 12:52:37 2009 (r686) @@ -14,7 +14,7 @@ # Default-Enabled: yes PATH=/usr/lib/xen-common/bin:/sbin:/bin:/usr/sbin:/usr/bin -VERSION=$(xen-utils-version -q 2>/dev/null || true) +VERSION=$(xen-utils-version) ROOT=/usr/lib/xen-$VERSION test "$VERSION" || exit 0 Modified: trunk/xen-common/scripts/xen-utils-version =============================================================================--- trunk/xen-common/scripts/xen-utils-version Mon Nov 16 19:57:24 2009 (r685) +++ trunk/xen-common/scripts/xen-utils-version Wed Nov 18 12:52:37 2009 (r686) @@ -1,48 +1,28 @@ #!/bin/bash -while getopts "qv:" OPT; do +while getopts "v" OPT; do case "$OPT" in - q) - QUIET=1 - ;; v) - VERSION="$OPTARG" + VERBOSE=1 ;; esac done -if [ -z "$VERSION" ]; then - if [ -e "/sys/hypervisor/type" ]; then - if [ "$(cat /sys/hypervisor/type)" = xen ]; then - DIR=/sys/hypervisor/version - VERSION_EXTRA=$(cat $DIR/extra) - if [ "$VERSION_EXTRA" = "-unstable" ]; then - VERSION=unstable - else - VERSION="$(cat $DIR/major).$(cat $DIR/minor)$VERSION_EXTRA" - fi +if [ -e "/sys/hypervisor/type" ]; then + if [ "$(cat /sys/hypervisor/type)" = xen ]; then + DIR=/sys/hypervisor/version + VERSION_EXTRA=$(cat $DIR/extra) + if [ "$VERSION_EXTRA" = "-unstable" ]; then + VERSION=unstable else - [ "$QUIET" ] || echo "WARING! Can''t read type from sysfs!" >&2 + VERSION="$(cat $DIR/major).$(cat $DIR/minor)$VERSION_EXTRA" fi else - [ "$QUIET" ] || echo "WARING! Can''t find hypervisor information in sysfs!" >&2 + [ "$VERBOSE" ] && echo "WARING! Can''t read type from sysfs!" >&2 fi +else + [ "$VERBOSE" ] && echo "WARING! Can''t find hypervisor information in sysfs!" >&2 fi -if [ -z "$VERSION" ]; then - VERSION="default" -fi - -if [ -d "/usr/lib/xen-$VERSION" ]; then - echo "$VERSION" - exit 0 -fi - -if [ -d "/usr/lib/xen-default" ]; then - [ "$QUIET" ] || echo "WARING! Can''t find version $VERSION of xen utils, fallback to default version!" >&2 - echo "default" - exit 0 -fi - -[ "$QUIET" ] || echo "ERROR! Can''t find default version of xen utils, bailing out!" >&2 -exit 1 +echo "$VERSION" +exit 0 Modified: trunk/xen-common/scripts/xen-utils-wrapper =============================================================================--- trunk/xen-common/scripts/xen-utils-wrapper Mon Nov 16 19:57:24 2009 (r685) +++ trunk/xen-common/scripts/xen-utils-wrapper Wed Nov 18 12:52:37 2009 (r686) @@ -1,7 +1,22 @@ #!/bin/bash -libdir=/usr/lib -command="$(basename $0)" -version=$($libdir/xen-common/bin/xen-utils-version -v "$XEN_VERSION") -[ "$version" ] && exec "$libdir/xen-$version/bin/$command" "$@" -exit 127 +set -e + +COMMAND="$(basename $0)" +VERSION=$(/usr/lib/xen-common/bin/xen-utils-version -v) + +if [ -z "$VERSION" ]; then + VERSION="default" +fi + +if [ -d "/usr/lib/xen-$VERSION" ]; then + DIR="/usr/lib/xen-$VERSION" +elif [ -d "/usr/lib/xen-default" ]; then + echo "WARING! Can''t find version $VERSION of xen utils, fallback to default version!" >&2 + DIR="/usr/lib/xen-default" +else + echo "ERROR! Can''t find default version of xen utils, bailing out!" >&2 + exit 127 +fi + +exec "$libdir/xen-$version/bin/$command" "$@"