From 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 Jul 2018 21:03:06 +0100 Subject: gentoo resync : 14.07.2018 --- app-emulation/xen-tools/files/xencommons.initd | 79 ++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 app-emulation/xen-tools/files/xencommons.initd (limited to 'app-emulation/xen-tools/files/xencommons.initd') 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" +} + -- cgit v1.2.3