blob: 24debedd8ca5728aeb4372a6102caaef4542451b (
plain) (
tree)
|
|
# -----------------------------------------------------------------------------
#
# Copyright (c) 2009..2018 bwLehrpool-Projektteam
#
# This program/file is free software distributed under the GPL version 2.
# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
#
# If you have any feedback please consult https://bwlehrpool.de and
# send your feedback to support@bwlehrpool.de.
#
# General information about bwLehrpool can be found at https://bwlehrpool.de
#
# -----------------------------------------------------------------------------
# run-virt.include
# - component for vmware/player of the vmchooser plugin vmchooser-run_virt
################################################################################
# BASH_SOURCE[0] contains the file being sourced, namely this one
declare -rg VMWARE_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")"
declare -rg VMWARE_INCLUDE_DIR="${VMWARE_PLUGIN_DIR}/includes"
# TODO make this part of the metadata coming from the server
# Define which features the VMware plugin supports
declare -rg PLUGIN_FEATURES="firewall printer usb slxfloppy sound netshares"
run_plugin() {
# declaration of default functions and variables for vmware
$(safesource --exit "${VMWARE_INCLUDE_DIR}/init_core.inc")
# get information from downloaded vmx
$(safesource "${VMWARE_INCLUDE_DIR}/parse_vmx.inc")
# determine limitations wrt RAM and CPU count of VM
$(safesource "${VMWARE_INCLUDE_DIR}/determine_hardware_limitations.inc")
# create preferences file ${HOME}/.vmware/preferences
$(safesource "${VMWARE_INCLUDE_DIR}/create_vmhome_preferences_file.inc")
# parse the given vmx file
$(safesource "${VMWARE_INCLUDE_DIR}/write_final_vmx.inc")
# print summary - needs writelog() from vmchooser-run_virt
$(safesource "${VMWARE_INCLUDE_DIR}/log_config_summary.inc")
# For debugging
cp "$VM_RUN_FILE" "/tmp/vmware-last-config"
# If we have multi-screen, try to switch to blackbox, seems the only
# lean WM to handle this properly.
if [ "$DISPLAY_COUNT" -gt 1 ] && command -v xfwm4 > /dev/null; then
start_wm "xfwm4"
fi
# HACK: make the mouse disappear
(
local WINDOWS="$(xdotool search --sync --name '.*VMware.*Player.*')"
isempty WINDOWS && writelog "Could not find any vmplayer windows."
for WINDOW in $WINDOWS; do
xdotool set_desktop_for_window $WINDOW 0 || writelog "Could not move vmplayer to desktop 0"
xdotool windowactivate --sync $WINDOW || writelog "Could not activate vmplayer window"
xdotool key --delay 2000 --clearmodifiers ctrl+g || writelog "Could not send ctrl+g to vmplayer window"
done
) &
# HACK: using the modified version of the wrapper script
declare -rg VIRTCMD="/opt/openslx/bin/vmplayer"
# -X for fullscreen, plus VMX file
VIRTCMDOPTS+=( "-X" "${VM_RUN_FILE}" )
}
|