diff options
author | Simon Rettberg | 2015-03-04 16:08:22 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-03-04 16:08:22 +0100 |
commit | 2d7177a3710e791057c55f65bdcbe7d6012d214c (patch) | |
tree | eaa853920bf046b965a7f6820c23a2530c008d89 /remote/modules | |
parent | [freiburg-config] sssd: etc/sssd/sssd.conf perms adjusted (or tried to) (diff) | |
download | tm-scripts-2d7177a3710e791057c55f65bdcbe7d6012d214c.tar.gz tm-scripts-2d7177a3710e791057c55f65bdcbe7d6012d214c.tar.xz tm-scripts-2d7177a3710e791057c55f65bdcbe7d6012d214c.zip |
[vm*] Only explicitly set sound card if there's more than one in the host system
Diffstat (limited to 'remote/modules')
3 files changed, 23 insertions, 11 deletions
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 726c2340..d41bf564 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -445,24 +445,26 @@ fi if true; then # detecting which card is to be used echo "Detecting which sound card to use ..." - PROC="/proc/asound/cards" + PROC="/proc/asound/cards" if [ ! -r "$PROC" ]; then echo "'${PROC}' not found or not readable." SOUND_CARD_INDEX=0 + SOUND_CARD_COUNT=1 else # Try to filter HDMI cards first - SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]{0,2}[0-9]+[[:space:]]+' | head -n 1) # If empty, try again with all - [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) - + [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]{0,2}[0-9]+[[:space:]]+' | head -n 1) if [ -z "${SOUND_CARD_INDEX}" ]; then echo "No sound card found." SOUND_CARD_INDEX=0 fi + SOUND_CARD_COUNT=$(grep -E '^[[:space:]]{0,2}[0-9]+[[:space:]]+' "${PROC}" | wc -l) fi SOUND_CARD_INDEX="$(grep -E -o '[0-9]+' <<<$SOUND_CARD_INDEX)" echo "Detected sound card index is: $SOUND_CARD_INDEX" + echo "Sound card count: $SOUND_CARD_COUNT" # Adjust sound volume (playback)... Random mixer names we have encountered during testing echo "Setting up volume..." 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 726c2340..d41bf564 100755 --- a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt @@ -445,24 +445,26 @@ fi if true; then # detecting which card is to be used echo "Detecting which sound card to use ..." - PROC="/proc/asound/cards" + PROC="/proc/asound/cards" if [ ! -r "$PROC" ]; then echo "'${PROC}' not found or not readable." SOUND_CARD_INDEX=0 + SOUND_CARD_COUNT=1 else # Try to filter HDMI cards first - SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]{0,2}[0-9]+[[:space:]]+' | head -n 1) # If empty, try again with all - [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) - + [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]{0,2}[0-9]+[[:space:]]+' | head -n 1) if [ -z "${SOUND_CARD_INDEX}" ]; then echo "No sound card found." SOUND_CARD_INDEX=0 fi + SOUND_CARD_COUNT=$(grep -E '^[[:space:]]{0,2}[0-9]+[[:space:]]+' "${PROC}" | wc -l) fi SOUND_CARD_INDEX="$(grep -E -o '[0-9]+' <<<$SOUND_CARD_INDEX)" echo "Detected sound card index is: $SOUND_CARD_INDEX" + echo "Sound card count: $SOUND_CARD_COUNT" # Adjust sound volume (playback)... Random mixer names we have encountered during testing echo "Setting up volume..." 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 016ebdc6..47c96ec1 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 @@ -258,15 +258,15 @@ runvmwareconfheader () ethernet0.present = "TRUE" ethernet0.addressType = "static" $network_virtualDev - ethernet0.connectionType = "hostonly" - #ethernet1.connectionType = "custom" + #ethernet0.connectionType = "hostonly" + ethernet0.connectionType = "custom" ethernet0.vnet = "$hostdev" ethernet0.address = "00:50:56:$macaddrsuffix" ethernet0.wakeOnPcktRcv = "FALSE" # sound sound.present = "TRUE" - sound.fileName = "sysdefault:CARD=$SOUND_CARD_INDEX" + $sound_fileName sound.autodetect = "FALSE" sound.virtualdev = "$sound" pciSound.enableVolumeControl = "FALSE" @@ -469,6 +469,14 @@ esac # set standard sound card, overwrite depending on OS (options sb16, es1371, hdaudio) sound="es1371" +# set sound card explicitly if there is more than one card in the host system +if [ -n "$SOUND_CARD_INDEX" -a -n "$SOUND_CARD_COUNT" ] && [ "$SOUND_CARD_COUNT" -gt 1 ]; then + sound_fileName="sound.fileName = \"sysdefault:CARD=${SOUND_CARD_INDEX}\"" +else + sound_fileName='sound.fileName = "-1" +sound.autodetect = "TRUE"' +fi + # check for 3D configuration setting case "$enable3d" in true|yes) |