#!/bin/bash
# Check if certificates exist. If not, we need to generate them, ala sshd.
if [ ! -e /etc/vmware/ssl/rui.key -o ! -e /etc/vmware/ssl/rui.crt ]; then
chmod 0600 /etc/vmware/ssl
openssl req -x509 -days 365 -newkey rsa:2048 -keyout /etc/vmware/ssl/rui.key -out /etc/vmware/ssl/rui.crt -config /etc/vmware/ssl/hostd.ssl.config
chmod 0600 /etc/vmware/ssl/rui.key /etc/vmware/ssl/rui.crt
fi
File shutdown-autostart-vm.sh
# "Shutdown VMs in the AutoStart Sequence"
HOHO_ADMIN="$(/opt/vmware/bin/vmware-wssc-adminTool "/etc/vmware/hostd/authorization.xml" 2>/dev/null)"
if [ "x" != "x${HOHO_ADMIN}" ]; then
/opt/vmware/bin/vmware-vim-cmd -U "${HOHO_ADMIN}" hostsvc/autostartmanager/autostop
fi
The changes are summarized as follows.
Put the systemd services in files folder instead of downloading them.
Create vmware-workstation-server.target, and move vmware-authentication.service from vmware.target to vmware-workstation-server.target.
Create vmware-hostd.service to start hostd service, and create two scripts, which are invoked by this service, to check certificates and shutdown autostart VMs.
Use systemctl command instead of rc-service commands In configure-hostd.sh.
Create libvmware-vim-cmd.so link to libvmware-hostd.so to make vmware-vim-cmd work.
To enable Vmware Workstation Server in systemd, I modified the vmware-workstation-15.0.2.10952284-r2.ebuild. The differences are as follows.
The modified files and new files are listed as follows.
File
vmware.target
,vmware-authentication.service
is removed from this file.File
vmware-workstation-server.target
File
vmware-authentication.service
, PartOf is modified to vmware-workstation-server.target.File
vmware-hostd.service
File
configure-hostd_systemd.sh
, which is installed as/opt/vmware/lib/vmware/bin/configure-hostd.sh
.File
check-certificates.sh
File
shutdown-autostart-vm.sh
The changes are summarized as follows.