summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware/data/opt/openslx
diff options
context:
space:
mode:
authorJonathan Bauer2018-02-14 13:15:54 +0100
committerJonathan Bauer2018-02-14 13:15:54 +0100
commit780e9ebdf01db68760d95d86d09f8bc37d676dba (patch)
tree6ada795174dd2b8fc4a76ead45026e670eb8e399 /core/modules/vmware/data/opt/openslx
parent[lightdm-greeter-bwlp] fix path (diff)
parent[run-virt] relax /tmp mount detection regex (diff)
downloadmltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.gz
mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.xz
mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.zip
Merge branch 'master' into install-mode
Diffstat (limited to 'core/modules/vmware/data/opt/openslx')
-rwxr-xr-xcore/modules/vmware/data/opt/openslx/bin/vmplayer13
-rwxr-xr-xcore/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env157
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc2
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc4
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc12
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc36
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvrambin8664 -> 270840 bytes
-rw-r--r--core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include11
8 files changed, 160 insertions, 75 deletions
diff --git a/core/modules/vmware/data/opt/openslx/bin/vmplayer b/core/modules/vmware/data/opt/openslx/bin/vmplayer
index cfb91a0a..05a4ec3a 100755
--- a/core/modules/vmware/data/opt/openslx/bin/vmplayer
+++ b/core/modules/vmware/data/opt/openslx/bin/vmplayer
@@ -5,13 +5,12 @@ PREFIX=/usr/lib/vmware # depends on the vmware location
# HACK: Let the OpenGL driver report s3tc capability even if not present, so 3D will be enabled
export force_s3tc_enable=true
-PROG=$(basename $0)
-
-exec "$PREFIX/lib/wrapper-gtk24.sh" \
- "$PREFIX/lib" \
- "$PREFIX/bin/$PROG" \
- "$PREFIX/libconf" "$@"
-
+# Turn off "helpful" DE features
+export APPMENU_DISPLAY_BOTH=1
+export UBUNTU_MENUPROXY=0
+export GNOME_DISABLE_CRASH_DIALOG=1
+PROG=$(basename $0)
+exec "$PREFIX/bin/$PROG" "$@"
diff --git a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env
index 0f3e270e..18959170 100755
--- a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env
+++ b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env
@@ -1,18 +1,18 @@
#!/bin/ash
# -----------------------------------------------------------------------------
-# Copyright (c) 2013 - 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/
+# Copyright (c) 2013 - 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/
# -----------------------------------------------------------------------------
# systemd-vmware_env
# - This is the systemd configuration and provisioning script for the various
-# VMware modules and services
+# VMware modules and services
################################################################################
export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin"
@@ -20,49 +20,78 @@ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin"
VMWARE_CONF_DIR=/opt/openslx/vmchooser/vmware
VMCHOOSER_CONF_DIR=/opt/openslx/vmchooser/config
+. /opt/openslx/config
+
load_modules () {
local FAILED=""
- # module stuff
- insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon"
- insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet"
- #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci"
- #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock"
- #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock"
+ # module stuff
+ insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon"
+ insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet"
+ #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci"
+ #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock"
+ #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock"
[ -n "$FAILED" ] && slxlog "vmware-insmod" "Error loading vmware kernel module(s) $FAILED"
}
-unload_modules () {
- rmmod vmnet vmmon #vsock vmci vmblock
+unload_modules () {
+ rmmod vmnet vmmon #vsock vmci vmblock
+}
+
+vmnet_create() {
+ vmnet="$1"
+ # first, create device node
+ dev="/dev/vmnet${vmnet}"
+ if ! [ -c "$dev" ] && ! mknod "${dev}" c 119 "${vmnet}"; then
+ slxlog "vmware-node-vmnet" "Could not create ${dev}"
+ return 1
+ fi
+ chmod 0700 "${dev}"
+ # now bring it up
+ if ! /usr/bin/vmnet-netifup -d "/var/run/vmnet-netifup-vmnet${vmnet}.pid" "${dev}" "vmnet${vmnet}" ; then
+ slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet${vmnet} failed."
+ fi
+ ip link set dev "vmnet${vmnet}" up
}
-vmnetif () {
+vmnetif () {
+ local vmnet nic NICS
# create the needed devices which effects all vmware options
# they are not created automatically via module load
- for device in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \
- "/dev/vmnet2 c 119 2" "/dev/vmmon c 10 165"; do
- mknod ${device}
+ if ! [ -e /dev/vmmon ]; then
+ mknod /dev/vmmon c 10 165 || slxlog "vmware-node-vmmon" "Could not create /dev/vmmon"
+ fi
+ # network interfaces
+ # 1) default ones
+ for vmnet in 0 1 2; do
+ vmnet_create "$vmnet"
done
- chmod 0700 /dev/vmnet*
-
+ # Set the vmware interface to 9000 too, as br0 will use the smallest of all slave devices
+ [ "x$SLX_JUMBO_FRAMES" = "xyes" ] && ip link set dev vmnet0 mtu 9000
# setup bridge (vmnet0), nat (vmnet1) and software defined networking (vmnet2) interfaces
- if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet0.pid /dev/vmnet0 vmnet0 ; then
- slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet0 failed."
- fi
- ip link set dev vmnet0 up
- brctl addif br0 vmnet0
- if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid /dev/vmnet1 vmnet1; then
- slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet1 failed."
- fi
- ip link set dev vmnet1 up
- brctl addif nat1 vmnet1
- if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet2.pid /dev/vmnet2 vmnet2; then
- slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet2 failed."
+ brctl addif br0 vmnet0
+ brctl addif nat1 vmnet1
+ brctl addif vsw2 vmnet2
+ # 2) see if we should bridge additional interfaces
+ NICS=
+ if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then
+ # These will have been set up in our init
+ NICS=$( ls -1 /sys/class/net | grep '^br-nic-' | cut -c 8- )
+ vmnet=10
+ for nic in $NICS; do
+ if ! [ "$nic" -gt 0 ] && ! [ "$nic" -eq 0 ]; then
+ slxlog "vmware-other-nics" "NaN: br-nic-X has X='$nic'"
+ continue
+ fi
+ # create vmnet10 - vmnetN for these
+ vmnet_create "$vmnet"
+ brctl addif "br-nic-${nic}" "vmnet${vmnet}"
+ vmnet="$(( vmnet + 1 ))"
+ done
fi
- ip link set dev vmnet2 up
- brctl addif vsw2 vmnet2
+
}
-vmblock () {
+vmblock () {
if ! /usr/bin/vmware-usbarbitrator; then
slxlog "vmware-usbarb" "Launching /usr/bin/vmware-usbarbitrator failed."
fi
@@ -72,31 +101,31 @@ vmblock () {
mkdir -p "/tmp/virt/vmware" "/dev/shm/vmware" "/run/vmware" -m 1777
# FixMe: Should be rewritten for proper systemd operation
-case "$1" in
- start)
- # hack to access the first serial/parallel port
- [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0
- [ -c /dev/parport0 ] && chmod a+rw /dev/parport0
- load_modules
- vmnetif
- vmblock
- ;;
- stop)
- #stop: defines stop function for initscript
- killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray
- # might take a while until all services are shut down
- sleep 0.5
- unload_modules
-
- ;;
- restart)
- #restart: defines restart function for initscript
- $0 stop && $0 start
- ;;
- status)
- #status: defines status function for initscript
- vmstatus
- ;;
+case "$1" in
+ start)
+ # hack to access the first serial/parallel port
+ [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0
+ [ -c /dev/parport0 ] && chmod a+rw /dev/parport0
+ load_modules
+ vmnetif
+ vmblock
+ ;;
+ stop)
+ #stop: defines stop function for initscript
+ killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray
+ # might take a while until all services are shut down
+ sleep 0.5
+ unload_modules
+
+ ;;
+ restart)
+ #restart: defines restart function for initscript
+ $0 stop && $0 start
+ ;;
+ status)
+ #status: defines status function for initscript
+ vmstatus
+ ;;
esac
# Breaks performance with certain workloads, so disable.
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc
index 2e1ed1c4..b4197051 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc
@@ -58,6 +58,8 @@ create_vmhome_preferences_file() {
pref.vmplayer.confirmOnExit = "TRUE"
pref.backgroundOnClose = "FALSE"
pref.trayicon.enabled = "FALSE"
+ pref.keyboardAndMouse.vmHotKey.enabled = "FALSE"
+ pref.keyboardAndMouse.vmHotKey.count = "0"
# shared folders
pref.enableAllSharedFolders = "TRUE"
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
index 85fafc9f..d7ad77c6 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc
@@ -27,7 +27,9 @@ declare -rg VM_CONF_DIR="/tmp/virt/vmware/${USER}.$$"
declare -rg VM_RUN_FILE="${VM_CONF_DIR}/run-vmware.conf"
# Users vmware config folder
-[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$(whoami)" | awk -F ':' '{print $6}')
+[ -z "$UID" ] && UID=$(id -u)
+[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$UID" | awk -F ':' '{print $6}')
+[ -z "${HOME}" ] && slxlog "run-virt-vmware-home" "Could not get home directory of user $(whoami) ($UID)"
declare -rg VM_HOME="${HOME}/.vmware"
# mltk generates a vmware config file with several version infos for vmware/player, read it
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc
index 6ca82acb..47330bb0 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc
@@ -3,6 +3,17 @@
######################################################################
## Functions
parse_vmx() {
+ # To avoid potential syntax problems from the vmx served by dmsd, sanitize
+ # it before continuing with filling in the gaps
+ local TMPTMPCONFIG="$(mktemp)"
+ grep -E '^\s*(#|[^=]+=[^"]*"[^"]*"\s*$|[^=]+=[^"]+$|$)' "$TMPCONFIG" > "$TMPTMPCONFIG"
+ if ! diff -q "$TMPCONFIG" "$TMPTMPCONFIG"; then
+ # file was corrupted, log it
+ writelog "'$TMPCONFIG' had bad syntax and was pruned by the post-download sanitizer!"
+ slxlog -s "virt-vmware-vmx-corrupt" "Downloaded .vmx for '$IMGUUID' has a corrupted format!" "$TMPCONFIG"
+ fi
+ mv -f -- "$TMPTMPCONFIG" "$TMPCONFIG"
+
writelog "Parsing virtual machine description file..."
local -i HW_VERSION=$(grep -i -m1 '^virtualHW.version *= *' "${TMPCONFIG}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g')
if notempty HW_VERSION; then
@@ -19,4 +30,3 @@ else
writelog "Path to VMX file is not set or empty! Aborting..."
EXIT_TYPE="internal" EXIT_REASON="Konnte Pfad zur VMX-Datei nicht finden!" cleanexit 1
fi
-
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
index 84ddee1d..a7d3d837 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
@@ -22,6 +22,38 @@ replace_placeholders() {
setup_ethernet() {
echo 'ethernet0.addressType = "static"' >> "${TMPCONFIG}"
echo 'ethernet0.address = "'"${VM_MAC_ADDR}"'"' >> "${TMPCONFIG}"
+ if [ -n "$OTHER_NICS" ]; then
+ local devtype mac cnt eth
+ # Copy type of eth0, in case the others don't specify a type in the vmx, we'll use the same
+ # so we know the drivers are there
+ devtype=$(< "${TMPCONFIG}" grep -m1 -i '^ethernet0\.virtualDev' | sed -r 's/^[^=]+//;s/^(\s|=|")*//;s/(\s|")+$//') # TODO: Make a helper like "getVmxOption"
+ cnt=0
+ for mac in $OTHER_NICS; do
+ vmnet=$(( cnt + 10 ))
+ cnt=$(( cnt + 1 ))
+ eth="ethernet${cnt}"
+ # Check device exists
+ if ! [ -c "/dev/vmnet${vmnet}" ]; then
+ slxlog "vmware-bridge-setup" "Cannot bridge NIC into VM: /dev/vmnet${vmnet} does not exist"
+ continue
+ fi
+ # Remove lines that could break things
+ sed -i "/^${eth}\.connectionType/Id;/^${eth}\.present/Id" "${TMPCONFIG}"
+ # Set up devType
+ devline=
+ if ! grep -q -i "^${eth}\.virtualDev" "${TMPCONFIG}" && [ -n "$devtype" ]; then
+ devline="${eth}.virtualDev = "'"'"${devtype}"'"'
+ fi
+ cat >> "${TMPCONFIG}" <<-HEND
+ ${eth}.connectionType = "custom"
+ ${eth}.present = "TRUE"
+ ${eth}.vnet = "vmnet${vmnet}"
+ ${eth}.addressType = "static"
+ ${eth}.address = "${mac}"
+ ${devline}
+ HEND
+ done
+ fi
}
# DVD, CDROM
@@ -50,8 +82,8 @@ setup_floppies() {
# Floppies:
cat >> "${TMPCONFIG}" <<-HEREEND
- floppy0.present = "$FLOPPY0"
- floppy0.startConnected = "FALSE"
+ floppy0.present = "TRUE"
+ floppy0.startConnected = "$FLOPPY0"
floppy0.autodetect = "TRUE"
floppy0.fileName = "auto detect"
floppy1.present = "$SLX_FLOPPY"
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram
index 85125f1e..88074390 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram
Binary files differ
diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
index 181ae44c..a552038b 100644
--- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
+++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include
@@ -43,6 +43,17 @@ run_plugin() {
# 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"