diff options
author | William Pitcock <nenolod@dereferenced.org> | 2010-12-27 18:37:21 -0600 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2010-12-28 21:15:44 -0600 |
commit | 6bb05082baccd776b01adae1768c010220c8a9aa (patch) | |
tree | efb295686334d0b5533fc965919241ce35a35a71 /testing | |
parent | d16919042d04958d058eb71a618a8d0c4836789c (diff) | |
download | aports-6bb05082baccd776b01adae1768c010220c8a9aa.tar.bz2 aports-6bb05082baccd776b01adae1768c010220c8a9aa.tar.xz |
testing/xen: add initscripts for xend and xendomains.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/xen/APKBUILD | 15 | ||||
-rw-r--r-- | testing/xen/xend.initd | 38 | ||||
-rw-r--r-- | testing/xen/xendomains.initd | 63 |
3 files changed, 112 insertions, 4 deletions
diff --git a/testing/xen/APKBUILD b/testing/xen/APKBUILD index 094f42abd1..86eb067706 100644 --- a/testing/xen/APKBUILD +++ b/testing/xen/APKBUILD @@ -2,12 +2,12 @@ # Maintainer: William Pitcock <nenolod@dereferenced.org> pkgname=xen pkgver=4.0.1 -pkgrel=0 +pkgrel=1 pkgdesc="Xen hypervisor" url="http://www.xen.org/" license="GPL" depends= -makedepends="coreutils python sed gawk libgcrypt-dev gnutls-dev pciutils-dev texinfo git wget" +makedepends="coreutils python sed gawk libgcrypt-dev gnutls-dev pciutils-dev texinfo git wget mesa-dev sdl-dev" install= subpackages="$pkgname-doc" source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.gz @@ -16,7 +16,9 @@ source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.g xen-disable-firmware.patch xen-disable-fsback.patch xen-disable-werror.patch - xen-dont-use-lib64.patch" + xen-dont-use-lib64.patch + xend.initd + xendomains.initd" arch="x86 x86_64" _builddir="$srcdir"/$pkgname-$pkgver @@ -58,6 +60,9 @@ package() { unset LDFLAGS make DESTDIR="$pkgdir" install-xen install-tools install-stubdom + + install -m755 -D "$srcdir"/xend.initd "$pkgdir"/etc/init.d/xend + install -m755 -D "$srcdir"/xendomains.initd "$pkgdir"/etc/init.d/xendomains } md5sums="d197afad975ab2396a67323d57388c27 xen-4.0.1.tar.gz @@ -66,4 +71,6 @@ edb5c3e7fba8214702fac709f0e53124 xen-blktap-uclibc.patch a569f16a7e3c832ba3fab6154f657244 xen-disable-firmware.patch 03d1fff892e627b812bba4e6c56d696a xen-disable-fsback.patch 949d0d3bc1e8f300a849279b60760c6a xen-disable-werror.patch -b6599060e22b61dabee0fe460b4a0c9d xen-dont-use-lib64.patch" +b6599060e22b61dabee0fe460b4a0c9d xen-dont-use-lib64.patch +1d81b04f8c8b919879a73f0e3d2fe80f xend.initd +a2b5234483f1b5892d22e9315d9c307f xendomains.initd" diff --git a/testing/xen/xend.initd b/testing/xen/xend.initd new file mode 100644 index 0000000000..6958c0479f --- /dev/null +++ b/testing/xen/xend.initd @@ -0,0 +1,38 @@ +#!/sbin/runscript + +depend() { + need net + before xendomains sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp +} + +is_privileged_domain() { + grep -qsE '^control_d$' /proc/xen/capabilities + return $? +} + +start() { + if is_privileged_domain ; then + ebegin "Starting Xen daemons" + /usr/sbin/xend start + eend $? + else + eerror "Can't start xend - not a privileged domain" + return 1 + fi +} + +stop() { + ebegin "Stopping Xen control daemon" + /usr/sbin/xend stop + eend $? +} + +restart() { + ebegin "Restarting Xen control daemon" + /usr/sbin/xend restart + eend $? +} + +status() { + is_privileged_domain && /usr/sbin/xend status +} diff --git a/testing/xen/xendomains.initd b/testing/xen/xendomains.initd new file mode 100644 index 0000000000..d12577c2b0 --- /dev/null +++ b/testing/xen/xendomains.initd @@ -0,0 +1,63 @@ +#!/sbin/runscript + +depend() { + need xend + after dhcp +} + +get_domname() { + 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 +} + +is_running() { + /usr/sbin/xm list "${1}" >/dev/null 2>&1 +} + +start() { + einfo "Starting Xen domains in ${AUTODIR:=/etc/xen/auto}" + + 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}" + xm create --quiet ${dom} + eend $? + else + einfo " Not starting ${name} - already running." + fi + done +} + +stop() { + einfo "Stopping Xen domains in ${AUTODIR:=/etc/xen/auto}" + + 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}" + xm shutdown ${name} >/dev/null + eend $? + fi + done + + for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do + name=$(get_domname ${dom}) + if is_running ${name} ; then + ebegin " Waiting for domain ${name} to shutdown" + xm shutdown --wait ${name} + eend $? + else + einfo " Not stopping ${name} - not running." + fi + done +} + +status() { + /usr/sbin/xm list +} |