[Pkg-xen-changes] r922 - trunk/xen-common/debian/scripts
Bastian Blank
waldi at alioth.debian.org
Wed Oct 26 20:40:29 UTC 2011
Author: waldi
Date: Wed Oct 26 20:40:29 2011
New Revision: 922
Log:
debian/scripts/xen-version:
- Detect empty type.
- Error out if no version is found.
Modified:
trunk/xen-common/debian/scripts/xen-version
Modified: trunk/xen-common/debian/scripts/xen-version
==============================================================================
--- trunk/xen-common/debian/scripts/xen-version Wed Oct 26 20:25:12 2011 (r921)
+++ trunk/xen-common/debian/scripts/xen-version Wed Oct 26 20:40:29 2011 (r922)
@@ -10,16 +10,18 @@
esac
done
-warn() {
+error() {
if [ "$VERBOSE" ]; then
- echo "WARNING! " "$@" >&2
+ echo "ERROR: " "$@" >&2
fi
+ exit 1
}
if [ -e "/sys/hypervisor/type" ]; then
- if [ "$(cat /sys/hypervisor/type)" = xen ]; then
+ type="$(cat /sys/hypervisor/type)"
+ if [ "$type" = xen ]; then
DIR=/sys/hypervisor/version
- VERSION_EXTRA="$(cat $DIR/extra)"
+ VERSION_EXTRA="$(cat $DIR/extra)"
if [ "$VERSION_EXTRA" = "-unstable" ]; then
# Old xen-unstable
VERSION=unstable
@@ -29,12 +31,13 @@
else
VERSION="$(cat $DIR/major).$(cat $DIR/minor)"
fi
+ elif [ -z "$type" ]; then
+ error "Can't read hypervisor type from sysfs!"
else
- warn "Can't read type from sysfs!"
+ error "Hypervisor is not xen but '$type'!"
fi
else
- warn "Can't find hypervisor information in sysfs!"
+ error "Can't find hypervisor information in sysfs!"
fi
echo "$VERSION"
-exit 0
More information about the Pkg-xen-changes
mailing list