aboutsummaryrefslogtreecommitdiffstats
path: root/community/xe-guest-utilities
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-02-09 19:04:23 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-02-09 19:04:23 +0000
commit32ed852b41f14d3987c0ccb40d270f7c5762d875 (patch)
tree4b718c9ea85b922edd56e40d380898c3d8f760f7 /community/xe-guest-utilities
parenta1efd54ed04ff81475ca14b75dcec07a0c3cf517 (diff)
downloadaports-32ed852b41f14d3987c0ccb40d270f7c5762d875.tar.bz2
aports-32ed852b41f14d3987c0ccb40d270f7c5762d875.tar.xz
community/xe-guest-utilities: move from main due to go dependency
Diffstat (limited to 'community/xe-guest-utilities')
-rw-r--r--community/xe-guest-utilities/APKBUILD55
-rw-r--r--community/xe-guest-utilities/identify_alpine.patch43
-rw-r--r--community/xe-guest-utilities/xe-guest-utilities.initd50
3 files changed, 148 insertions, 0 deletions
diff --git a/community/xe-guest-utilities/APKBUILD b/community/xe-guest-utilities/APKBUILD
new file mode 100644
index 0000000000..e344814dbb
--- /dev/null
+++ b/community/xe-guest-utilities/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Cedric Schieli <cschieli@gmail.com>
+# Maintainer: Cedric Schieli <cschieli@gmail.com>
+pkgname=xe-guest-utilities
+pkgver=6.6.80
+pkgrel=0
+pkgdesc="XenServer guest tools"
+url="https://github.com/xenserver/xe-guest-utilities"
+arch="x86 x86_64"
+license="BSD-2-Clause"
+depends=
+makedepends=go
+install=
+subpackages="${pkgname}-udev:udev:noarch"
+options="!check"
+source="${pkgname}-${pkgver}.tar.gz::https://github.com/xenserver/${pkgname}/archive/v${pkgver}.tar.gz
+ $pkgname.initd
+ identify_alpine.patch
+ "
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$_builddir/mk"
+
+ for i in ../*.diff ../*.patch; do
+ [ -f $i ] || continue
+ msg "Applying $i..."
+ patch -s -p1 -N < $i || return 1
+ done
+}
+
+build() {
+ cd "$_builddir"
+ make
+}
+
+package() {
+ mkdir -p "$pkgdir"
+ cp -ar "${_builddir}/build/stage/usr/" "$pkgdir/"
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+udev() {
+ pkgdesc="udev rules for CPU hotplugging when running as Xen DomU"
+ depends="udev"
+
+ udev_dir="etc/udev/rules.d"
+ mkdir -p "${subpkgdir}/${udev_dir}"
+ filename="z10_xen-vcpu-hotplug.rules"
+ install -m644 -D "${_builddir}/build/stage/${udev_dir}/${filename}" "${subpkgdir}/${udev_dir}/${filename}"
+}
+
+sha512sums="8b4519e5c23cb57b2ee86435cec8078912921d2c9c49f90eddba6f0f122d0dec0091690d5280bebb7af97c13095640b6cb77ea7e1a813d828dd31514096069aa xe-guest-utilities-6.6.80.tar.gz
+3e898b473f6e71ecc5b820717df0a460b31756b68f4bb9bf454df39f430e64ca5e33582c03bfea044d93f49937883fe9b6807c31dee72307750de670bfca8bcd xe-guest-utilities.initd
+94d0d3c6f082dc76e7a76b48d1ecfff7d38ba6da344d1fdfa94c7a8f6c23ca726bccc7b1c8934f41ab06bb9a6b8582aec7448a99d17598b19dc8f3a73f1cd08a identify_alpine.patch"
diff --git a/community/xe-guest-utilities/identify_alpine.patch b/community/xe-guest-utilities/identify_alpine.patch
new file mode 100644
index 0000000000..d645c139ab
--- /dev/null
+++ b/community/xe-guest-utilities/identify_alpine.patch
@@ -0,0 +1,43 @@
+--- xe-guest-utilities-5.5.0.orig/xe-linux-distribution
++++ xe-guest-utilities-5.5.0/xe-linux-distribution
+@@ -248,6 +248,32 @@
+ write_to_output "${distro}" "${major}" "${minor}" "${description}"
+ }
+
++identify_alpine()
++{
++ alpine_release="$1"
++ local major
++ local minor
++
++ if [ ! -f "${alpine_release}" ] ; then
++ return 1
++ fi
++
++ eval $(sed -n \
++ -e 's/^.*-\([0-9]*\)\.\([0-9]*\)\.[0-9]* .*$/major=\1;minor=\2/gp;' \
++ -e 's/^.*-\([0-9]*\) .*$/major=\1;minor=/gp;' \
++ "${alpine_release}")
++
++ if [ -z "${major}" ] ; then
++ return 1
++ fi
++
++ if [ -z "${minor}" ] ; then
++ minor=0
++ fi
++
++ write_to_output "alpine" "${major}" "${minor}" "Alpinelinux $(head -n 1 $alpine_release)"
++}
++
+ if [ $# -eq 1 ] ; then
+ exec 1>"$1"
+ fi
+@@ -257,6 +283,7 @@
+ identify_sles /etc/SuSE-release && exit 0
+ identify_lsb lsb_release && exit 0
+ identify_debian /etc/debian_version && exit 0
++ identify_alpine /etc/alpine-release && exit 0
+
+ if [ $# -eq 1 ] ; then
+ rm -f "$1"
diff --git a/community/xe-guest-utilities/xe-guest-utilities.initd b/community/xe-guest-utilities/xe-guest-utilities.initd
new file mode 100644
index 0000000000..59362ef453
--- /dev/null
+++ b/community/xe-guest-utilities/xe-guest-utilities.initd
@@ -0,0 +1,50 @@
+#!/sbin/openrc-run
+
+XE_LINUX_DISTRIBUTION=/usr/sbin/xe-linux-distribution
+XE_LINUX_DISTRIBUTION_CACHE=/var/cache/xe-linux-distribution
+XE_DAEMON=/usr/sbin/xe-daemon
+XE_DAEMON_PIDFILE=/var/run/xe-daemon.pid
+
+name=xe-daemon
+daemon=/usr/sbin/$name
+
+depend() {
+ need localmount
+ after bootmisc
+}
+
+start() {
+ if [ ! -d /proc/xen ]; then
+ return
+ fi
+
+ ebegin "Detecting Linux distribution version"
+ ${XE_LINUX_DISTRIBUTION} ${XE_LINUX_DISTRIBUTION_CACHE}
+ eend $?
+
+ if [ ! -e /proc/xen/xenbus ] ; then
+ ebegin "Mounting xenfs on /proc/xen"
+ if [ ! -d /proc/xen ] ; then
+ /bin/false
+ else
+ mount -t xenfs none /proc/xen
+ fi
+ eend $?
+ fi
+
+ ebegin "Starting ${name}"
+ mkdir -p $(dirname ${XE_DAEMON_PIDFILE})
+ ( exec &>/dev/null ; ${XE_DAEMON} -p ${XE_DAEMON_PIDFILE} & )
+ eend $?
+}
+
+stop() {
+ if [ ! -d /proc/xen ]; then
+ return
+ fi
+
+ ebegin "Stopping ${name}"
+ kill -TERM $(cat ${XE_DAEMON_PIDFILE})
+ eend $?
+}
+