app-emulation/xen-tools: add ebuild
Package-Manager: Portage-2.3.69, Repoman-2.3.16
This commit is contained in:
parent
52217b65e1
commit
1d8dbdb1a6
19 changed files with 1115 additions and 0 deletions
79
app-emulation/xen-tools/files/xencommons.initd
Normal file
79
app-emulation/xen-tools/files/xencommons.initd
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2019 Gentoo Authors
|
||||
# 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"
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue