smoverlay/app-emulation/vmware-workstation/files/vmware-server-15.0.rc

53 lines
1.5 KiB
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need localmount vmware
use net
}
checkconfig() {
checkpath -d /var/run/vmware
# Check if certificates exist. If not, we need to generate them, ala sshd.
if [ ! -e @@ETCDIR@@/ssl/rui.key -o ! -e @@ETCDIR@@/ssl/rui.crt ]; then
checkpath -d -m 0600 @@ETCDIR@@/ssl
openssl req -x509 -days 365 -newkey rsa:2048 -keyout @@ETCDIR@@/ssl/rui.key -out @@ETCDIR@@/ssl/rui.crt -config @@ETCDIR@@/ssl/hostd.ssl.config
checkpath -f -m 0600 @@ETCDIR@@/ssl/rui.key @@ETCDIR@@/ssl/rui.crt
fi
}
start() {
checkconfig
ebegin Starting VMware Authentication Daemon
start-stop-daemon --start \
--exec @@PREFIX@@/sbin/vmware-authdlauncher
eend $?
ebegin Starting VMware Workstation Server
start-stop-daemon --start \
--pidfile /var/run/vmware/vmware-hostd.PID \
--exec @@BINDIR@@/vmware-hostd \
-- -a -d @@ETCDIR@@/hostd/config.xml
eend $?
}
stop() {
ebegin "Shutdown VMs in the AutoStart Sequence"
local HOHO_ADMIN="$(@@BINDIR@@/vmware-wssc-adminTool "@@ETCDIR@@/hostd/authorization.xml" 2>/dev/null)"
if [ "x" != "x${HOHO_ADMIN}" ]; then
@@BINDIR@@/vmware-vim-cmd -U "${HOHO_ADMIN}" hostsvc/autostartmanager/autostop
fi
eend $?
ebegin Stopping VMware Workstation Server
start-stop-daemon --stop \
--pidfile /var/run/vmware/vmware-hostd.PID
eend $?
ebegin Stopping VMware Authentication Daemon
killall --wait vmware-authdlauncher
eend $?
}