diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-02-12 10:44:07 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-02-12 10:50:12 +0000 |
commit | 97935b308484879fd7117fcaf46cffa84552caaf (patch) | |
tree | e593c3271f81f72eb3f2f801a13fd4852e60e63a /main/xen/xendomains.initd | |
parent | cd46eba6f617f9d99d6485c14d2375fb4bdd68ca (diff) | |
download | aports-97935b308484879fd7117fcaf46cffa84552caaf.tar.bz2 aports-97935b308484879fd7117fcaf46cffa84552caaf.tar.xz |
main/xen: upgrade to 4.1.2
Diffstat (limited to 'main/xen/xendomains.initd')
-rw-r--r-- | main/xen/xendomains.initd | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/main/xen/xendomains.initd b/main/xen/xendomains.initd index d12577c2b0..0f309ef3d0 100644 --- a/main/xen/xendomains.initd +++ b/main/xen/xendomains.initd @@ -1,22 +1,64 @@ #!/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 +else + LOCKFILE=/var/lock/xendomains +fi + +if [ -d /etc/sysconfig ]; then + XENDOM_CONFIG=/etc/sysconfig/xendomains +else + XENDOM_CONFIG=/etc/default/xendomains +fi + +if ! [ -r $XENDOM_CONFIG ]; then + eend 1; + echo "$XENDOM_CONFIG not existing"; + exit 1; +fi + +. $XENDOM_CONFIG + depend() { - need xend - after dhcp + need xencommons + after net xend } get_domname() { - local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) + local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) - if [[ -z ${name_from_file} ]] ; then - basename "${1}" - else - echo ${name_from_file} - fi + if [[ -z ${name_from_file} ]] ; then + basename "${1}" + else + echo ${name_from_file} + fi } is_running() { - /usr/sbin/xm list "${1}" >/dev/null 2>&1 + /usr/sbin/$CMD list "${1}" >/dev/null 2>&1 } start() { @@ -26,7 +68,7 @@ start() { name=$(get_domname ${dom}) if ! is_running ${name} ; then ebegin " Starting domain ${name}" - xm create --quiet ${dom} + /usr/sbin/$CMD create --quiet --defconfig ${dom} eend $? else einfo " Not starting ${name} - already running." @@ -41,7 +83,7 @@ stop() { name=$(get_domname ${dom}) if is_running ${name} ; then ebegin " Sending shutdown signal to ${name}" - xm shutdown ${name} >/dev/null + /usr/sbin/$CMD shutdown ${name} >/dev/null eend $? fi done @@ -50,7 +92,7 @@ stop() { name=$(get_domname ${dom}) if is_running ${name} ; then ebegin " Waiting for domain ${name} to shutdown" - xm shutdown --wait ${name} + /usr/sbin/$CMD shutdown --wait ${name} eend $? else einfo " Not stopping ${name} - not running." @@ -59,5 +101,5 @@ stop() { } status() { - /usr/sbin/xm list + /usr/sbin/$CMD list } |