summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service11
l---------remote/modules/alsa/data/etc/systemd/system/multi-user.target.wants/alsa-default-card.service1
-rwxr-xr-xremote/modules/alsa/data/opt/openslx/scripts/alsa-default_card47
-rwxr-xr-xremote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt32
-rwxr-xr-xremote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt3
-rw-r--r--remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include261
6 files changed, 209 insertions, 146 deletions
diff --git a/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service b/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service
new file mode 100644
index 00000000..db35eeb7
--- /dev/null
+++ b/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Set default card ALSA will use
+DefaultDependencies=no
+After=tmp.target
+Wants=tmp.target
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/alsa-default_card
+RemainAfterExit=yes
+
diff --git a/remote/modules/alsa/data/etc/systemd/system/multi-user.target.wants/alsa-default-card.service b/remote/modules/alsa/data/etc/systemd/system/multi-user.target.wants/alsa-default-card.service
new file mode 120000
index 00000000..55e393fd
--- /dev/null
+++ b/remote/modules/alsa/data/etc/systemd/system/multi-user.target.wants/alsa-default-card.service
@@ -0,0 +1 @@
+../alsa-default-card.service \ No newline at end of file
diff --git a/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card b/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card
new file mode 100755
index 00000000..4edfcdd5
--- /dev/null
+++ b/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card
@@ -0,0 +1,47 @@
+#!/bin/ash
+
+PROC="/proc/asound/cards"
+
+if [ ! -r "$PROC" ]; then
+ echo "'${PROC}' not found or not readable."
+ exit 1
+fi
+
+if [ -w "/etc" ]; then
+ FILE="/etc/asound.conf"
+elif [ -n "$HOME" ]; then
+ FILE="${HOME}/.asoundrc"
+else
+ FILE="$(getent passwd root | awk -F ':' '{print $6}')/.asoundrc"
+fi
+
+if [ -e "${FILE}" -a "x$1" != "x--force" ]; then
+ echo "'${FILE}' already exists, use --force to overwrite."
+ exit 1
+fi
+
+# Try to filter HDMI cards first
+CARD=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+# If empty, try again with all
+[ -z "${CARD}" ] && CARD=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1)
+
+if [ -z "${CARD}" ]; then
+ echo "No sound card found."
+ exit 1
+fi
+
+cat > "${FILE}" <<HEREDOC
+pcm.!default {
+ type hw
+ card $CARD
+}
+ctl.!default {
+ type hw
+ card $CARD
+}
+timer.!default {
+ type hw
+ card $CARD
+}
+HEREDOC
+
diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
index d93bcd51..231ef6fe 100755
--- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt
@@ -139,25 +139,25 @@ filecheck ()
################################################################################
## Added for persistent support.
-diskmode='nonpersistent' && \
+diskmode='nonpersistent'
if [[ "$(grep --extended-regexp \
'< *short_description *param=".+ --persistent--"' "$1")" ]]; then
- diskmode='persistent' && \
- imageFilePath="$(grep -io '<image_name param=.*"' "$1" \
- | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')" && \
+ diskmode='persistent'
+ imageFilePath="$(grep -io '<image_path param=.*"' "$1" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')"
+ [ -z "$imageFilePath" ] && imageFilePath="$(grep -io '<image_name param=.*"' "$1" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')"
originalXMLFilePath="$(grep -io '<original_xml_file_path param=.*"' "$1" \
- | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')" && \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')"
originalImageFileName="$(grep -io '<image_name param=.*"' \
"$originalXMLFilePath" | sed -e "s/&.*;/; /g" | awk -F '"' \
- '{ print $2 }')" && \
+ '{ print $2 }')"
originalVMDKFilePath="$(dirname \
- "$originalXMLFilePath")/${originalImageFileName}" && \
+ "$originalXMLFilePath")/${originalImageFileName}"
# Added to workaround path prefix coming from temporary generated xml file
# by vmchooser.
if [[ "$(grep --extended-regexp '^/tmp/tmp\.[^\/]+/' <<< \
"$imageFilePath")" ]]; then
imageFilePath=$(sed -r 's/^\/?tmp\/[^\/]+\///g' \
- <<< "$imageFilePath") && \
+ <<< "$imageFilePath")
sed -ir \
"s/(<image_name param=\")[^\"]*(\")/\\1$(sed -e \
's/\\/\\\\/g' -e 's/\//\\\//g' -e \
@@ -236,7 +236,9 @@ writelog "Enable 3D:\t\t${enable3d}"
writelog "VM config:"
# Name of the virt image
-imgname=$(grep -io '<image_name param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+imgname=$(grep -io '<image_path param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+imgrelpath=$(grep -io '<image_name param=.*"' "${xmlfile}" | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+[ -z "$imgname" ] && imgname="${imgrelpath}"
## Added for persistent support.
if [[ "$userBranchFilePath" ]]; then
@@ -244,7 +246,7 @@ if [[ "$userBranchFilePath" ]]; then
fi
##
-# Imagename /w full path
+# Imagename w/ full path
if echo "${imgname}" | grep -q '^/'; then
imgpath="$(dirname "${imgname}")"
imgname="$(basename "${imgname}")"
@@ -345,8 +347,6 @@ writelog "\tVM short name:\t\t$vm_shortname"
### Declaration of default variables
###############################################################################
-# VM-ID static (00)
-VM_ID="00"
# take last two digits of current pid...
VM_ID=$(expr substr $$ $(expr ${#$} - 1) 2)
@@ -454,7 +454,7 @@ QUEUE="STANDARD" # This has to match the queue you configured in your VM
USER="$(whoami)"
SPOOLDIR=
### Disabled: 100megs is not enough, some jobs are HUGE, try to use temp which should be on disk
-## Try using users tmpfs home first, as it gets wiped on logout
+## Try using user's tmpfs home first, as it gets wiped on logout
#if [ -n "${HOME}" ] && [ -w "${HOME}" ]; then
# SPOOLDIR="${HOME}/.spool"
# mkdir -p "${SPOOLDIR}/${QUEUE}"
@@ -467,6 +467,7 @@ if [ -z "${SPOOLDIR}" ] || [ ! -w "${SPOOLDIR}/${QUEUE}" ]; then
slxlog "virt-spooldir" "Could not create spool directory ($SPOOLDIR) for $USER - printing will not work!"
# TODO: Warn user
fi
+ chmod 0700 "${SPOOLDIR}/${QUEUE}"
fi
# Start the lpdaemon listening on the given port
@@ -496,7 +497,7 @@ if [ -n "$SLX_DNBD3_SERVERS" -o -n "$SLX_DNBD3_PRIO_SERVERS" ] && [ "x$SLX_VM_DN
# Shuffle server list
[ -n "$SLX_DNBD3_SERVERS" ] && TMP_SERVERS=$(for SRV in $SLX_DNBD3_SERVERS; do echo "$RANDOM $SRV"; done | sort -u | sed -r 's/^[0-9]+ //')
for SRV in $SLX_DNBD3_PRIO_SERVERS $TMP_SERVERS; do
- dnbd3=$(dnbd3-client -h "$SRV" -i "${vmpath#/mnt/vmstore/}" -r 0)
+ dnbd3=$(dnbd3-client -h "$SRV" -i "${imgrelpath}" -r 0)
RET=$?
if [ "$RET" = "0" ]; then
vm_revision=$(cat "/sys/block/${dnbd3#/dev/}/net/rid")
@@ -509,7 +510,7 @@ if [ -n "$SLX_DNBD3_SERVERS" -o -n "$SLX_DNBD3_PRIO_SERVERS" ] && [ "x$SLX_VM_DN
usleep 200000
done
if [ -z "$vm_diskfile" ]; then
- slxlog "virt-dnbd3" "No dnbd3 server for ${vmpath#/mnt/vmstore/} found ($SLX_DNBD3_PRIO_SERVERS $TMP_SERVERS $dnbd3error), trying NFS..."
+ slxlog "virt-dnbd3" "No dnbd3 server for ${imgrelpath} found ($SLX_DNBD3_PRIO_SERVERS $TMP_SERVERS $dnbd3error), trying NFS/CIFS..."
writelog "No working dnbd3 server found :-("
fi
else
@@ -519,6 +520,7 @@ else
writelog "Won't use dnbd3 as no servers are given in config"
fi
+# $vm_diskfile will be empty if dnbd3 is not used or failed. Let's try to fall back to NFS/CIFS via file system
if [ -z "$vm_diskfile" ]; then
new_vmpath=$(ls "${vmpath}.r"* | grep -E -o '\.r[0-9]+$' | grep -o -E '[0-9]+' | sort -n | tail -1)
[ -n "$new_vmpath" ] && vmpath="${vmpath}.r${new_vmpath}"
diff --git a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
index 59cddfed..231ef6fe 100755
--- a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
+++ b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt
@@ -446,6 +446,7 @@ amixer -q sset Front "$VOL" unmute 2>/dev/null
amixer -q sset Speaker "$VOL" unmute 2>/dev/null # annoying built-in speaker
amixer -q sset 'Front Mic' "$VOL" unmute 2>/dev/null # to be checked if Mic is actually activated
amixer -q sset 'Rear Mic' "$VOL" unmute 2>/dev/null # =""=
+amixer -q sset 'Capture' "$VOL" cap unmute 2>/dev/null # to be checked if Mic is actually activated
amixer -q -c pcsp sset Master "0%" mute 2>/dev/null # fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded
# Start printer daemon
@@ -482,7 +483,7 @@ PID_LPD="$!"
# via virtual floppy
cp "$xmlfile" "$VMCHOOSER_DIR/fd-loop/config.xml"
# Add another file with resolution information
-xrandr | grep -o -E 'connected\s*[0-9]+x[0-9]+\+0\+0' | grep -o -E '[0-9]+x[0-9]+' | head -n 1 > "$VMCHOOSER_DIR/fd-loop/hostres.txt"
+xrandr | grep -o -E 'connected\s*(primary)?\s*[0-9]+x[0-9]+\+0\+0' | grep -o -E '[0-9]+x[0-9]+' | head -n 1 > "$VMCHOOSER_DIR/fd-loop/hostres.txt"
# Add our magic openslx binary that sets the correct guest resolution
cp "$VMCHOOSER_DIR/data/openslx.exe" "$VMCHOOSER_DIR/fd-loop/"
diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
index e867a888..ef54218e 100644
--- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
+++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include
@@ -16,6 +16,7 @@
################################################################################
### configuration writer functions
+### This needs bash, not dash or ash! (indented HEREDOC)
################################################################################
vmostype=$(rv_clean_string "$vmostype")
@@ -172,152 +173,152 @@ runvmwareconfheader ()
MAXCORES="1"
;;
esac
-
- svga_autodetect="TRUE"
real_core_count="$cpu_cores"
[ "$cpu_cores" -gt "$MAXCORES" ] && cpu_cores="$MAXCORES"
# It currently makes no sense to set the virtual number of cores
# to a different value than the virtual number of cores per virtual CPU.
cores_per_socket="$cpu_cores"
-
+
if [ "x$shfolders" != "xFALSE" ]; then
ENABLE_SHARE='sharedFolder.option = "alwaysEnabled"'
else
ENABLE_SHARE=''
fi
-
+
[ "$mem" -ge "$MAXMEM" ] && mem="$MAXMEM"
[ "$hwver" -lt "7" -a "$mem" -gt "3500" ] && mem="3500"
-
+
cap3d="WHAT IS THIS VAR USED FOR?" # helper var for loging output
-
- cat >> "$conffile" <<HEREEND
-.encoding = "UTF-8"
-config.version = "8"
-
-# general hardware (ehci, 3d accel)
-ehci.present = "TRUE"
-$FORCE3D
-mks.enable3d = "$enable3d"
-
-monitor.virtual_mmu = "automatic"
-monitor.virtual_exec = "automatic"
-floppy1.clientDevice = "FALSE"
-floppy1.readonly = "TRUE"
-
-# id
-virtualHW.version = "$hwver"
-displayName = "$displayname"
-guestOS = "$vmostype"
-
-# CPU/MEM
-numvcpus = "$cpu_cores"
-cpuid.coresPerSocket = "$cores_per_socket"
-maxvcpus = "$real_core_count"
-memsize = "$mem"
-MemAllowAutoScaleDown = "FALSE"
-MemTrimRate = "-1"
-
-# ide-disks
-ide0:0.present = "$ide"
-ide0:0.fileName = "$vm_diskfile"
-## Edited for persistent mode.
-ide0:0.mode = "independent-${diskmode}"
-##
-ide1:0.present = "$cdrom0"
-ide1:0.autodetect = "TRUE"
-ide1:0.fileName = "auto detect"
-ide1:0.deviceType = "cdrom-raw"
-ide1:1.present = "$cdrom1"
-ide1:1.autodetect = "TRUE"
-ide1:1.fileName = "auto detect"
-ide1:1.deviceType = "cdrom-raw"
-
-# scsi-disks
-scsi0.present = "$scsi"
-scsi0:0.present = "$scsi"
-scsi0:0.fileName = "$vm_diskfile"
-scsi0.virtualDev = "$hddrv"
-## Edited for persistent mode.
-scsi0:0.mode = "independent-${diskmode}"$stateFileConfiguration
-##
-# floppies
-floppy0.present = "$floppy0"
-floppy0.startConnected = "FALSE"
-floppy0.autodetect = "TRUE"
-floppy0.fileName = "auto detect"
-
-# we need floppy b: for the client configuration
-floppy1.present = "$floppy1"
-floppy1.startConnected = "TRUE"
-floppy1.fileType = "file"
-floppy1.fileName = "$floppy1name"
-
-# nics
-ethernet0.present = "TRUE"
-ethernet0.addressType = "static"
-$network_virtualDev
-ethernet0.connectionType = "hostonly"
-#ethernet1.connectionType = "custom"
-ethernet0.vnet = "$hostdev"
-ethernet0.address = "00:50:56:$macaddrsuffix"
-ethernet0.wakeOnPcktRcv = "FALSE"
-
-# sound
-sound.present = "TRUE"
-sound.fileName = "-1"
-sound.autodetect = "TRUE"
-sound.virtualdev = "$sound"
-
-# svga
-svga.autodetect = "$svga_autodetect"
-
-# usb
-usb.present = "TRUE"
-usb.generic.autoconnect = "TRUE"
-
-# pci configuration
-usb.pciSlotNumber = "16"
-ethernet0.pciSlotNumber = "17"
-sound.pciSlotNumber = "18"
-ehci.pciSlotNumber = "19"
-scsi0.pciSlotNumber = "20"
+ cat >> "$conffile" <<-HEREEND
+ .encoding = "UTF-8"
+ config.version = "8"
+
+ # general hardware (ehci, 3d accel)
+ ehci.present = "TRUE"
+ $FORCE3D
+ mks.enable3d = "$enable3d"
+
+ monitor.virtual_mmu = "automatic"
+ monitor.virtual_exec = "automatic"
+ floppy1.clientDevice = "FALSE"
+ floppy1.readonly = "TRUE"
+
+ # id
+ virtualHW.version = "$hwver"
+ displayName = "$displayname"
+ guestOS = "$vmostype"
+
+ # CPU/MEM
+ numvcpus = "$cpu_cores"
+ cpuid.coresPerSocket = "$cores_per_socket"
+ maxvcpus = "$real_core_count"
+ memsize = "$mem"
+ MemAllowAutoScaleDown = "FALSE"
+ MemTrimRate = "-1"
+
+ # ide-disks
+ ide0:0.present = "$ide"
+ ide0:0.fileName = "$vm_diskfile"
+ ## Edited for persistent mode.
+ ide0:0.mode = "independent-${diskmode}"
+ ##
+ ide1:0.present = "$cdrom0"
+ ide1:0.autodetect = "TRUE"
+ ide1:0.fileName = "auto detect"
+ ide1:0.deviceType = "cdrom-raw"
+ ide1:1.present = "$cdrom1"
+ ide1:1.autodetect = "TRUE"
+ ide1:1.fileName = "auto detect"
+ ide1:1.deviceType = "cdrom-raw"
+
+ # scsi-disks
+ scsi0.present = "$scsi"
+ scsi0:0.present = "$scsi"
+ scsi0:0.fileName = "$vm_diskfile"
+ scsi0.virtualDev = "$hddrv"
+ ## Edited for persistent mode.
+ scsi0:0.mode = "independent-${diskmode}"$stateFileConfiguration
+ ##
+
+ # floppies
+ floppy0.present = "$floppy0"
+ floppy0.startConnected = "FALSE"
+ floppy0.autodetect = "TRUE"
+ floppy0.fileName = "auto detect"
+
+ # we need floppy b: for the client configuration
+ floppy1.present = "$floppy1"
+ floppy1.startConnected = "TRUE"
+ floppy1.fileType = "file"
+ floppy1.fileName = "$floppy1name"
+
+ # nics
+ ethernet0.present = "TRUE"
+ ethernet0.addressType = "static"
+ $network_virtualDev
+ ethernet0.connectionType = "hostonly"
+ #ethernet1.connectionType = "custom"
+ ethernet0.vnet = "$hostdev"
+ ethernet0.address = "00:50:56:$macaddrsuffix"
+ ethernet0.wakeOnPcktRcv = "FALSE"
+
+ # sound
+ sound.present = "TRUE"
+ sound.fileName = "-1"
+ sound.autodetect = "TRUE"
+ sound.virtualdev = "$sound"
+ pciSound.enableVolumeControl = "FALSE"
+ sound.enableVolumeControl = "FALSE"
+
+ # svga
+ svga.autodetect = "TRUE"
+
+ # usb
+ usb.present = "TRUE"
+ usb.generic.autoconnect = "TRUE"
+
+ # pci configuration
+ usb.pciSlotNumber = "16"
+ ethernet0.pciSlotNumber = "17"
+ sound.pciSlotNumber = "18"
+ ehci.pciSlotNumber = "19"
+ scsi0.pciSlotNumber = "20"
+
+ # shared folders
+ $ENABLE_SHARE
+ sharedFolder0.present = "$shfolders"
+ sharedFolder0.enabled = "$shfolders"
+ sharedFolder0.expiration = "never"
+ sharedFolder0.guestName = "$sharename"
+ sharedFolder0.hostPath = "$sharepath"
+ sharedFolder0.readAccess = "TRUE"
+ sharedFolder0.writeAccess = "TRUE"
+ sharedFolder.maxNum = "1"
+
+ # dirs/configs
+ tmpDirectory = "$redodir"
+ redoLogDir = "$redodir"
+ mainMem.useNamedFile = "TRUE"
+ snapshot.disabled = "TRUE"
+ tools.syncTime = "TRUE"
+ isolation.tools.hgfs.disable = "FALSE"
+ hgfs.mapRootShare = "TRUE"
+ isolation.tools.dnd.disable = "FALSE"
+ isolation.tools.copy.enable = "TRUE"
+ isolation.tools.paste.enabled = "TRUE"
+
+ # serial port
+ serial0.present = "$serial"
+ $serialdev
+
+ # parallel port
+ parallel0.present = "$parallel"
+ parallel0.bidirectional = "$paralbidi"
+ $paraldev
+ HEREEND
-# shared folders
-$ENABLE_SHARE
-sharedFolder0.present = "$shfolders"
-sharedFolder0.enabled = "$shfolders"
-sharedFolder0.expiration = "never"
-sharedFolder0.guestName = "$sharename"
-sharedFolder0.hostPath = "$sharepath"
-sharedFolder0.readAccess = "TRUE"
-sharedFolder0.writeAccess = "TRUE"
-sharedFolder.maxNum = "1"
-
-# dirs/configs
-tmpDirectory = "$redodir"
-redoLogDir = "$redodir"
-mainMem.useNamedFile = "TRUE"
-snapshot.disabled = "TRUE"
-tools.syncTime = "TRUE"
-isolation.tools.hgfs.disable = "FALSE"
-hgfs.mapRootShare = "TRUE"
-isolation.tools.dnd.disable = "FALSE"
-isolation.tools.copy.enable = "TRUE"
-isolation.tools.paste.enabled = "TRUE"
-
-# serial port
-serial0.present = "$serial"
-$serialdev
-
-# parallel port
-parallel0.present = "$parallel"
-parallel0.bidirectional = "$paralbidi"
-$paraldev
-HEREEND
-
# set the appropriate permissions for the vmware config file
chmod u+rwx "${conffile}" >/dev/null 2>&1
}