aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@entel.upc.edu>2012-02-22 00:19:13 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2012-03-08 18:20:25 +0000
commit87b35cc3a59287e2c1c540c6e263454992a27216 (patch)
treef757b5d7858e677ac4894a5afe376f2398bec21b /main
parentea858919b459042138958b7b669816a84026546a (diff)
downloadaports-87b35cc3a59287e2c1c540c6e263454992a27216.tar.bz2
aports-87b35cc3a59287e2c1c540c6e263454992a27216.tar.xz
main/xen: fix xendomains init script
Diffstat (limited to 'main')
-rw-r--r--main/xen/APKBUILD4
-rwxr-xr-x[-rw-r--r--]main/xen/xendomains.initd59
2 files changed, 36 insertions, 27 deletions
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
index d2ee0b66e8..4c266449d3 100644
--- a/main/xen/APKBUILD
+++ b/main/xen/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=xen
pkgver=4.1.2
-pkgrel=5
+pkgrel=6
pkgdesc="Xen hypervisor"
url="http://www.xen.org/"
arch="x86 x86_64"
@@ -95,4 +95,4 @@ fa06495a175571f4aa3b6cb88937953e librt.patch
c31163a3cd6cf58b4e9cac0e96812d65 e1000.patch
62b3c5a7cff38c12df2de89af5d83fa1 xencommons.initd
b5bfc08b82bc0d21193714719a719798 xend.initd
-86e7923383a906404da321d1814657e9 xendomains.initd"
+6c288547faadd4262afd2f86e39e99a3 xendomains.initd"
diff --git a/main/xen/xendomains.initd b/main/xen/xendomains.initd
index 0f309ef3d0..5077d82e03 100644..100755
--- a/main/xen/xendomains.initd
+++ b/main/xen/xendomains.initd
@@ -1,26 +1,5 @@
#!/sbin/runscript
-CMD=xm
-/usr/sbin/$CMD list &> /dev/null
-if test $? -ne 0
-then
- CMD=xl
-fi
-
-/usr/sbin/$CMD list &> /dev/null
-if test $? -ne 0
-then
- eend 1;
- exit 1;
-fi
-
-# Correct exit code would probably be 5, but it's enough
-# if xend complains if we're not running as privileged domain
-if ! [ -e /proc/xen/privcmd ]; then
- eend 1;
- exit 1;
-fi
-
# See docs/misc/distro_mapping.txt
if [ -d /var/lock/subsys ]; then
LOCKFILE=/var/lock/subsys/xendomains
@@ -37,7 +16,7 @@ fi
if ! [ -r $XENDOM_CONFIG ]; then
eend 1;
echo "$XENDOM_CONFIG not existing";
- exit 1;
+ return 1;
fi
. $XENDOM_CONFIG
@@ -61,14 +40,41 @@ is_running() {
/usr/sbin/$CMD list "${1}" >/dev/null 2>&1
}
+check_xen() {
+ CMD=xm
+ /usr/sbin/$CMD list &> /dev/null
+ if test $? -ne 0
+ then
+ CMD=xl
+ fi
+
+ /usr/sbin/$CMD list &> /dev/null
+ if test $? -ne 0
+ then
+ eend 1;
+ echo "Could not find xl or xm";
+ return 1;
+ fi
+
+ # Correct exit code would probably be 5, but it's enough
+ # if xend complains if we're not running as privileged domain
+ if ! [ -e /proc/xen/privcmd ]; then
+ eend 1;
+ echo "Could not find /proc/xen/privcmd";
+ return 1;
+ fi
+}
+
start() {
einfo "Starting Xen domains in ${AUTODIR:=/etc/xen/auto}"
+ check_xen
+
for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
name=$(get_domname ${dom})
if ! is_running ${name} ; then
ebegin " Starting domain ${name}"
- /usr/sbin/$CMD create --quiet --defconfig ${dom}
+ /usr/sbin/$CMD create --quiet --defconfig ${dom} >/dev/null 2>&1
eend $?
else
einfo " Not starting ${name} - already running."
@@ -79,11 +85,13 @@ start() {
stop() {
einfo "Stopping Xen domains in ${AUTODIR:=/etc/xen/auto}"
+ check_xen
+
for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
name=$(get_domname ${dom})
if is_running ${name} ; then
ebegin " Sending shutdown signal to ${name}"
- /usr/sbin/$CMD shutdown ${name} >/dev/null
+ /usr/sbin/$CMD shutdown ${name} >/dev/null 2>&1
eend $?
fi
done
@@ -92,7 +100,7 @@ stop() {
name=$(get_domname ${dom})
if is_running ${name} ; then
ebegin " Waiting for domain ${name} to shutdown"
- /usr/sbin/$CMD shutdown --wait ${name}
+ /usr/sbin/$CMD shutdown --wait ${name} >/dev/null 2>&1
eend $?
else
einfo " Not stopping ${name} - not running."
@@ -101,5 +109,6 @@ stop() {
}
status() {
+ check_xen
/usr/sbin/$CMD list
}