summaryrefslogtreecommitdiff
path: root/app-emulation/xen-tools/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-emulation/xen-tools/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-emulation/xen-tools/files')
-rw-r--r--app-emulation/xen-tools/files/gentoo-patches.conf162
-rw-r--r--app-emulation/xen-tools/files/stubs-32.h20
-rw-r--r--app-emulation/xen-tools/files/xen-consoles.logrotate5
-rw-r--r--app-emulation/xen-tools/files/xen-watchdog.initd6
-rw-r--r--app-emulation/xen-tools/files/xencommons.confd4
-rw-r--r--app-emulation/xen-tools/files/xencommons.initd79
-rw-r--r--app-emulation/xen-tools/files/xenconsoled.confd2
-rw-r--r--app-emulation/xen-tools/files/xenconsoled.initd33
-rw-r--r--app-emulation/xen-tools/files/xendomains-screen.confd25
-rw-r--r--app-emulation/xen-tools/files/xendomains.confd9
-rw-r--r--app-emulation/xen-tools/files/xendomains.initd-r2117
-rw-r--r--app-emulation/xen-tools/files/xenqemudev.confd7
-rw-r--r--app-emulation/xen-tools/files/xenqemudev.initd84
-rw-r--r--app-emulation/xen-tools/files/xenstored.confd2
-rw-r--r--app-emulation/xen-tools/files/xenstored.initd44
-rw-r--r--app-emulation/xen-tools/files/xenstored.initd-r142
16 files changed, 641 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/files/gentoo-patches.conf b/app-emulation/xen-tools/files/gentoo-patches.conf
new file mode 100644
index 000000000000..84b56bc7313c
--- /dev/null
+++ b/app-emulation/xen-tools/files/gentoo-patches.conf
@@ -0,0 +1,162 @@
+# Drop .config, fixes to gcc-4.6
+_gx001=" xen-4-fix_dotconfig-gcc.patch"
+_gx020=" xen-4.3-fix_dotconfig-gcc.patch"
+
+# Fix texi2html build error with new texi2html, qemu.doc.html
+_gx002=" xen-tools-4-docfix.patch"
+_gx003=" xen-tools-4-qemu-xen-doc.patch"
+
+_gx004=" xen-tools-4.2-pod-utf8-chars.patch"
+_gx005=" xen-tools-4.2-pod-docs.patch"
+_gx006=" xen-tools-4.2-pod-xl.patch"
+
+# Fix network broadcast on bridged networks
+_gx007=" xen-tools-3.4.0-network-bridge-broadcast.patch"
+
+# Bug 496708
+_gx008=" xen-tools-4-unbundle-ipxe.patch"
+#use system-seabios && epatch "${FILESDIR}"/${PN}-4-unbundle-seabios.patch
+
+# Fix bridge by idella4, bug #362575
+_gx009=" xen-tools-4.1.1-bridge.patch"
+
+# Conditional patch, fix in ebuild
+# Don't build ipxe with pie on hardened, Bug #360805
+#if gcc-specs-pie; then
+# epatch "${FILESDIR}"/ipxe-nopie.patch
+#fi
+
+# Prevent double stripping of files at install
+_gx010=" xen-4.2.0-nostrip.patch"
+_gx024+=" xen-4.4-nostrip.patch"
+
+# fix jobserver in Makefile
+_gx011=" xen-4.2.0-jserver.patch"
+_gx021=" xen-4.3-jserver.patch"
+
+# add missing header, Bug #467200
+_gx012=" xen-4-ulong.patch"
+_gx013=" xen-tools-4.2-xen_disk_leak.patch"
+
+# Set dom0-min-mem to kb; Bug #472982
+_gx014=" xen-4.2-configsxp.patch"
+
+# Bug 463840
+_gx015=" xen-tools-4.2.2-install.patch"
+_gx016=" xen-tools-4.2.2-rt-link.patch"
+
+# Bug 379537
+_gx017=" fix-gold-ld.patch"
+
+# Bug 510976
+_gx018=" xen-tools-4.2.4-udev-rules.patch"
+
+# bundled seabios
+_gx019=" xen-tools-4-anti-seabios-download.patch"
+_gx032=" xen-tools-4.5-anti-seabios-download.patch"
+
+# Bug 477676
+_gx022=" xen-tools-4.3-ar-cc.patch"
+_gx038=" xen-tools-4.8-ar-cc.patch"
+
+# Prevent file collision with qemu package Bug 478064
+_gx023=" qemu-bridge.patch"
+_gx025=" xen-4.4-qemu-bridge.patch"
+_gx031=" xen-4.5-qemu-bridge.patch"
+_gx039=" xen-4.8-qemu-bridge.patch"
+_gx043=" xen-4.10-qemu-bridge.patch"
+#mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+_gx026=" xen-tools-4.4-api-fix.patch"
+
+# Fix po file collision with app-emulation/qemu, while USE=qemu is enabled, Bug 508302
+_gx027=" xen-tools-4-qemu-fix-po-collision.patch"
+
+# Fix build failure with ncurses[tinfo], bug 526526
+_gx028=" xen-tools-4.4.1-tinfo.patch"
+
+# Don't download ovmf, use pre-released
+_gx029=" xen-tools-4-anti-ovmf-download.patch"
+
+# fix build err while using gcc-4.5.x, c99
+_gx033=" xen-tools-4.4.2-gcc99.patch"
+_gx034=" xen-tools-4.5.0-gcc99.patch"
+
+_gx035=" xen-tools-4.2-pod-docs-r1.patch"
+# disable stackcheck for hardened system, bug 569810
+_gx036=" xen-tools-4.6-no-stackcheck.patch"
+
+# increase stack to fix xenqemu err
+# https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03961.html
+_gx037=" xen-tools-4.6-increase-stack-size.patch"
+
+
+#Fix issues with zero-length records in migration v2"
+#https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/tools-fix-zero-length-records
+_gx040=" 0001-docs-Clarify-the-expected-behaviour-of-zero-length-r.patch
+ 0003-tools-libxc-Avoid-generating-inappropriate-zero-leng.patch
+ 0004-tools-python-Adjust-migration-v2-library-to-warn-abo.patch"
+
+_gx041=" 0002-tools-libxc-Tolerate-zero-length-records-in-migratio.patch"
+
+#Fix missing makedev(), major(), minor()
+_gx042=" xen-tools-4.8.2-makedev.patch"
+
+# Fix building with glibc 2.27, bug #648182
+_gx044=" xen-tools-4.9-glibc-memfd.patch"
+
+# xen-tools-4.8.2 patches set
+_gpv_xen_tools_482_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027} ${_gx032}
+${_gx028} ${_gx029}
+${_gx037} ${_gx040} ${_gx042}
+"
+
+# xen-tools-4.9.0 patches set
+_gpv_xen_tools_490_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+"
+
+# xen-tools-4.9.1 patches set
+_gpv_xen_tools_491_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+"
+
+_gpv_xen_tools_491_1="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
+
+# xen-tools-4.9.2 patches set
+_gpv_xen_tools_492_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
+
+# xen-tools-4.10.0 patches set
+_gpv_xen_tools_4100_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx043}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
diff --git a/app-emulation/xen-tools/files/stubs-32.h b/app-emulation/xen-tools/files/stubs-32.h
new file mode 100644
index 000000000000..a421528deb74
--- /dev/null
+++ b/app-emulation/xen-tools/files/stubs-32.h
@@ -0,0 +1,20 @@
+/* This file is automatically generated.
+ It defines a symbol `__stub_FUNCTION' for each function
+ in the C library which is a stub, meaning it will fail
+ every time called, usually setting errno to ENOSYS. */
+
+#ifdef _LIBC
+ #error Applications may not define the macro _LIBC
+#endif
+
+#define __stub_chflags
+#define __stub_fattach
+#define __stub_fchflags
+#define __stub_fdetach
+#define __stub_gtty
+#define __stub_lchmod
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_sstk
+#define __stub_stty
diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate
new file mode 100644
index 000000000000..c6445239b42f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-consoles.logrotate
@@ -0,0 +1,5 @@
+/var/log/xen-consoles/*.log {
+ rotate 7
+ missingok
+ compress
+}
diff --git a/app-emulation/xen-tools/files/xen-watchdog.initd b/app-emulation/xen-tools/files/xen-watchdog.initd
new file mode 100644
index 000000000000..6fbc54dfb2fa
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-watchdog.initd
@@ -0,0 +1,6 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/xenwatchdogd"
+command_args="30 15"
diff --git a/app-emulation/xen-tools/files/xencommons.confd b/app-emulation/xen-tools/files/xencommons.confd
new file mode 100644
index 000000000000..b9e22482966f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xencommons.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/xencommons
+
+# Load xen's kernel modules, and this will override defaults
+XEN_KERNEL_MODULES=""
diff --git a/app-emulation/xen-tools/files/xencommons.initd b/app-emulation/xen-tools/files/xencommons.initd
new file mode 100644
index 000000000000..a7c1efed9abe
--- /dev/null
+++ b/app-emulation/xen-tools/files/xencommons.initd
@@ -0,0 +1,79 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xenstored
+}
+
+is_privileged_domain() {
+ grep -qsE '^control_d$' /proc/xen/capabilities
+ return $?
+}
+
+handle_kernel_modules() {
+ local XEN_DEFAULT_KERNEL_MODULES="
+ xen-evtchn
+ xen-gntdev
+ xen-gntalloc
+ xen-blkback
+ xen-netback
+ xen-pciback
+ gntdev
+ netbk
+ blkbk
+ xen-scsibk
+ usbbk
+ pciback
+ xen-acpi-processor
+ blktap2
+ blktap
+ "
+
+ [ "$1" = "remove" ] && OPTS="-r"
+
+ XEN_KERNEL_MODULES="${XEN_KERNEL_MODULES:-${XEN_DEFAULT_KERNEL_MODULES}}"
+ for i in ${XEN_KERNEL_MODULES}; do
+ modprobe ${OPTS} $i 2>/dev/null
+ done
+ return 0
+}
+
+start() {
+ ebegin "Starting xencommons daemon"
+
+ # not running in Xen dom0 or domU
+ if [ ! -d /proc/xen ]; then
+ eend 1 "Not running in Xen mode"
+ return 1
+ fi
+
+ # mount xenfs in dom0 or domU with a pv_ops kernel
+ if ! test -f /proc/xen/capabilities && \
+ ! grep '^xenfs ' /proc/mounts >/dev/null;
+ then
+ mount -t xenfs xenfs /proc/xen
+ fi
+
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xencommons not started"
+ return 1
+ fi
+
+ handle_kernel_modules
+
+ eend $? "Failed to start xencommons"
+}
+
+stop () {
+ ebegin "Stopping xencommons"
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xencommons not started"
+ return 1
+ fi
+
+ handle_kernel_modules remove
+
+ eend $? "Failed to stop xencommons"
+}
+
diff --git a/app-emulation/xen-tools/files/xenconsoled.confd b/app-emulation/xen-tools/files/xenconsoled.confd
new file mode 100644
index 000000000000..b2e194bde46f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENCONSOLED_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenconsoled.initd b/app-emulation/xen-tools/files/xenconsoled.initd
new file mode 100644
index 000000000000..094871cd0478
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need xenstored
+ after lvm
+}
+
+# bug #498720
+shutdown_all_domU() {
+ # Note: shutdown all domU, including manually started ones
+ local V=$(xl info| awk "/xen_minor/ { print \$3 }")
+ # 4.2.2 do not support "-a" option
+ [ $V -gt 2 ] && xl shutdown -a -w >/dev/null
+}
+
+start() {
+ ebegin "Starting xenconsoled daemon"
+ start-stop-daemon --start --exec /usr/sbin/xenconsoled \
+ --pidfile /run/xenconsoled.pid \
+ -- --pid-file=/run/xenconsoled.pid \
+ ${XENCONSOLED_OPTS}
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenconsoled daemon"
+ shutdown_all_domU
+ start-stop-daemon --stop --exec /usr/sbin/xenconsoled \
+ --pidfile /run/xenconsoled.pid
+ eend $*
+}
diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd
new file mode 100644
index 000000000000..e75e19d3be74
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains-screen.confd
@@ -0,0 +1,25 @@
+# /etc/conf.d/xendomains
+
+# Directory of domains to boot. AUTODIR should contain one or more symlinks
+# to domain config files in /etc/xen
+# AUTODIR=/etc/xen/auto
+
+# Send shutdown commands to all domains in parallel instead of waiting for
+# each to shutdown individually
+# PARALLEL_SHUTDOWN=yes
+
+# When SCREEN="yes", domains in AUTODIR have their consoles connected to a
+# screen session named SCREEN_NAME, with output logged to individual files
+# named after each domain and written to /var/log/xen-consoles/ . These files
+# are rotated (using app-admin/logrotate) every time xendomains is started.
+
+SCREEN="yes"
+SCREEN_NAME="xen"
+
+# Number of seconds between writes to screen's logfiles.
+#
+# Lower values mean more disk activity and hence a possible performance
+# impact, but higher values mean a greater chance of loosing some output
+# in the event of a crash.
+
+SCREEN_LOG_INTERVAL="1"
diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd
new file mode 100644
index 000000000000..90c1f5256c62
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.confd
@@ -0,0 +1,9 @@
+# /etc/conf.d/xendomains
+
+# Directory of domains to boot. AUTODIR should contain one or more symlinks
+# to domain config files in /etc/xen
+AUTODIR=/etc/xen/auto
+
+# Send shutdown commands to all domains in parallel instead of waiting for
+# each to shutdown individually
+PARALLEL_SHUTDOWN=yes
diff --git a/app-emulation/xen-tools/files/xendomains.initd-r2 b/app-emulation/xen-tools/files/xendomains.initd-r2
new file mode 100644
index 000000000000..0926498ceac4
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.initd-r2
@@ -0,0 +1,117 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="status"
+
+depend() {
+ need xenstored
+ after dhcp xend xenconsoled
+}
+
+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/xl list "${1}" >/dev/null 2>&1
+}
+
+using_screen() {
+ [ "${SCREEN}" = "yes" -o "${SCREEN}" = "YES" ]
+}
+
+set_screen_cmd() {
+ screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X"
+}
+
+start() {
+ set_screen_cmd
+
+ einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}"
+ if using_screen ; then
+ ebegin "Creating screen session to hold domain consoles"
+ ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \
+ && sleep 5 \
+ && ${screen_cmd} zombie dr \
+ && logrotate -f /etc/xen/xen-consoles.logrotate \
+ && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \
+ && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \
+ && ${screen_cmd} log on \
+ && ${screen_cmd} deflog on ) >/dev/null
+ if [ $? -ne 0 ] ; then
+ eend 1
+ return 1
+ else
+ eend
+ fi
+ fi
+ # Create all domains with config files in AUTODIR.
+ 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}"
+ if using_screen ; then
+ ${screen_cmd} screen -t ${name} xl create ${dom} -c
+ else
+ xl create --quiet ${dom}
+ fi
+ eend $?
+ else
+ einfo " Not starting domain ${name} - already running"
+ fi
+ done
+}
+
+stop() {
+ set_screen_cmd
+
+ einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}"
+ # Stop all domains with config files in AUTODIR.
+ DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)"
+
+ if [ "$PARALLEL_SHUTDOWN" = "yes" ] ; then
+ for dom in $DOMAINS ; do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Asking domain ${name} to shutdown in the background..."
+ xl shutdown -w ${name} >/dev/null &
+ else
+ einfo " Not stopping domain ${name} - not running"
+ fi
+ done
+ einfo " Waiting for shutdown of domains that are still running"
+ wait
+ eend $?
+ else
+ for dom in $DOMAINS ; do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Waiting for domain ${name} to shutdown"
+ xl shutdown -w ${name} >/dev/null
+ eend $?
+ else
+ einfo " Not stopping domain ${name} - not running"
+ fi
+ done
+ fi
+ if using_screen ; then
+ if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then
+ ebegin "Closing screen session ${SCREEN_NAME}"
+ ${screen_cmd} quit
+ eend $?
+ else
+ eend 0
+ fi
+ fi
+}
+
+status() {
+ /usr/sbin/xl list
+}
diff --git a/app-emulation/xen-tools/files/xenqemudev.confd b/app-emulation/xen-tools/files/xenqemudev.confd
new file mode 100644
index 000000000000..5b49520aa0ee
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenqemudev.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/xenqemudev
+
+# To enable QEMU file backend, set to 'yes'
+XENQEMUDEV_FILE_BACKEND_ENABLE=""
+
+# Common options for xenqemudev
+XENQEMUDEV_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenqemudev.initd b/app-emulation/xen-tools/files/xenqemudev.initd
new file mode 100644
index 000000000000..9dcbb3f2244e
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenqemudev.initd
@@ -0,0 +1,84 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need xencommons xenstored xenconsoled
+}
+
+is_privileged_domain() {
+ grep -qsE '^control_d$' /proc/xen/capabilities
+ return $?
+}
+
+xen_setvars() {
+ . /etc/xen/scripts/hotplugpath.sh
+
+ XENQEMUDEV_PIDFILE=/run/xenqemudev.pid
+
+ # xen-4.5 change the path
+ XEN_QEMU="${LIBEXEC}/qemu-system-i386"
+ [ -e ${XEN_QEMU} ] && return
+ XEN_QEMU="${LIBEXEC_BIN}/qemu-system-i386"
+}
+
+xen_qemu_start() {
+ if [ -z "${XENQEMUDEV_FILE_BACKEND_ENABLE}" ]; then
+ ewarn " QEMU disk backend not enabled"
+ ewarn " enable XENQEMUDEV_FILE_BACKEND_ENABLE in /etc/conf.d/xenqemudev"
+ return 1
+ fi
+
+ xen_setvars
+
+ if [ ! -c /dev/xen/gntdev ]; then
+ einfo " Xen gntdev driver not loaded"
+ return 1
+ fi
+
+ if [ -e "${XEN_QEMU}" ]; then
+ einfo " Starting QEMU as disk backend for dom0"
+
+ XENQEMUDEV_DEFAULT_OPTS="-xen-domid 0 -xen-attach -name dom0 \
+ -nographic -M xenpv -daemonize \
+ -monitor /dev/null -serial /dev/null -parallel /dev/null"
+
+ XENQEMUDEV_OPTS=${XENQEMUDEV_OPTS:-${XENQEMUDEV_DEFAULT_OPTS}}
+
+ start-stop-daemon --start --exec ${XEN_QEMU} \
+ --pidfile ${XENQEMUDEV_PIDFILE} \
+ -- -pidfile ${XENQEMUDEV_PIDFILE} \
+ ${XENQEMUDEV_OPTS}
+ return $?
+ fi
+}
+
+start() {
+ ebegin "Starting xenqemudev daemon"
+
+ # not running in Xen dom0 or domU
+ if [ ! -d /proc/xen ]; then
+ eend 1 "Not running in Xen mode"
+ return 1
+ fi
+
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xenqemudev not started"
+ return 1
+ fi
+
+ xen_qemu_start
+
+ eend $? "Failed to start xenqemudev"
+}
+
+stop () {
+ ebegin "Stopping xenqemudev"
+
+ xen_setvars
+
+ start-stop-daemon --stop --exec ${XEN_QEMU} \
+ --pidfile ${XENQEMUDEV_PIDFILE}
+
+ eend $? "Stopping xenqemudev, as it cannot be restarted."
+}
diff --git a/app-emulation/xen-tools/files/xenstored.confd b/app-emulation/xen-tools/files/xenstored.confd
new file mode 100644
index 000000000000..31b9293aa328
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENSTORED_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenstored.initd b/app-emulation/xen-tools/files/xenstored.initd
new file mode 100644
index 000000000000..1b7eec92658a
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd
@@ -0,0 +1,44 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+ need xencommons
+}
+
+xenstored_dir_check() {
+ # create dir dynamically
+ local i
+ for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
+ [ -x $i ] || mkdir -p $i
+ done
+}
+
+start() {
+ ebegin "Starting xenstored daemon"
+ xenstored_dir_check
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid \
+ -- --pid-file=/run/xenstored.pid \
+ $XENSTORED_OPTS
+ until xenstore-exists / || $((15 < ++i))
+ do
+ echo -n .
+ sleep 1
+ done
+ einfo "Setting domain0 name record"
+ /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
+ local V=$(xl info| awk "/xen_minor/ { print \$3 }")
+ [ $V -ge 4 ] && /usr/bin/xenstore-write "/local/domain/0/domid" 0
+
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid
+ eend $?
+}
+
diff --git a/app-emulation/xen-tools/files/xenstored.initd-r1 b/app-emulation/xen-tools/files/xenstored.initd-r1
new file mode 100644
index 000000000000..88d3ad7ba890
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd-r1
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+ need xencommons
+}
+
+xenstored_dir_check() {
+ # create dir dynamically
+ local i
+ for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
+ [ -x $i ] || mkdir -p $i
+ done
+}
+
+start() {
+ ebegin "Starting xenstored daemon"
+ xenstored_dir_check
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid \
+ -- --pid-file=/run/xenstored.pid \
+ $XENSTORED_OPTS
+ until xenstore-exists / || $((15 < ++i))
+ do
+ printf "."
+ sleep 1
+ done
+ einfo "Setting domain0 name record"
+ /usr/libexec/xen/bin/xen-init-dom0
+
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid
+ eend $?
+}
+