summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include')
-rw-r--r--core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include61
1 files changed, 61 insertions, 0 deletions
diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
new file mode 100644
index 00000000..a552038b
--- /dev/null
+++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
@@ -0,0 +1,61 @@
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2017 - RZ Uni Freiburg
+# Copyright (c) 2009..2017 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# 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"
+
+ # 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"
+ declare -rg VIRTCMDOPTS="${VM_START_OPTIONS} ${VM_RUN_FILE}"
+}