diff options
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc | 12 | ||||
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc | 24 |
2 files changed, 32 insertions, 4 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc index 61a73bb2..42740059 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc @@ -83,7 +83,15 @@ setup_virtual_floppy() { # which is coincidentally the one we received from dmsd :) if load_dmsd_resource NETSHARES; then if [ -s "${NETSHARES}" ]; then - cat $NETSHARES >> "${SHARES}" + # try to detect if we are running windows and replace '/' with '\' + # in an attempt to fix an improperly given samba path + cmd=(cat) + if [[ "$( tr '[A-Z]' '[a-z]' <<< ${VM_OS_TYPE})" = *windows* ]]; then + cmd=(tr / '\\') + fi + < $NETSHARES "${cmd[@]}" >> "${SHARES}" + # replace the tag for the username, if present + sed -i 's/%loginuser%/'"${USER}"'/g' "${SHARES}" fi fi @@ -108,8 +116,10 @@ setup_virtual_floppy() { createMissingRemap=${SHARE_CREATE_MISSING_REMAP} remapMode=${SHARE_REMAP_MODE_INI} homeDrive=${SHARE_HOME_DRIVE} + megaDrive=SEGA scriptExt=${EXT} passCreds=${SHARE_CREDENTIAL_PASSTHROUGH} + bootIp=${SLX_PXE_CLIENT_IP} [remap] documents=${SHARE_DOCUMENTS} diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc index 0fa60aa7..2d8b60dd 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc @@ -2,8 +2,25 @@ ################################################## # Include: Detect and pass USB devices to the VM # ################################################## -# TODO USB devices -declare -rg PASSTHROUGH_USB_DEVICES="2 0:5 0:6 0:7 0:14 0:16 0:17 239" + +declare -g PASSTHROUGH_USB_DEVICES="2 0:5 0:6 0:7 0:14 0:16 0:17 239" + +# include USB IDs explicitly given by SLX_PASSTHROUGH_USB_ID +# which is expected to be a space-separated list! +. /opt/openslx/config +if [ -n "${SLX_PASSTHROUGH_USB_ID}" ]; then + while IFS= read -ra USB_ID; do + for ID in ${USB_ID[@]}; do + # validate each entry and add them to the list if they pass + if ! [[ "${ID}" =~ ^[0-9a-f]{4}:[0-9a-f]{4}$ ]]; then + writelog "Rejected USB ID: '${ID}'." + continue + fi + PASSTHROUGH_USB_DEVICES+=" ${ID}" + done + done <<< "${SLX_PASSTHROUGH_USB_ID}" +fi +readonly PASSTHROUGH_USB_DEVICES # Helper function that will scan /dev/bus/usb for devices matching specific classes # and then output the corresponding device ids. This can be used for selective @@ -62,7 +79,8 @@ get_usb_devices_int() { [[ "$MATCH" == *";${DC}:${value};"* ]] && OK=yo fi fi - if [ -n "$OK" -a -n "$VENDOR" -a -n "$PRODUCT" ]; then + if [ -n "$OK" -a -n "$VENDOR" -a -n "$PRODUCT" ] || \ + [[ "$MATCH" == *";${VENDOR}:${PRODUCT};"* ]]; then echo "$EXP" | sed "s/%VENDOR%/${VENDOR}/g;s/%PRODUCT%/${PRODUCT}/g" break fi |