diff options
author | Simon Rettberg | 2014-09-29 16:05:53 +0200 |
---|---|---|
committer | root | 2014-09-29 16:05:53 +0200 |
commit | adc62a87e207bfc5add709672ba031e78b309363 (patch) | |
tree | f0601834f0fb3811f8e04a6a35c97a0cdf313fe0 | |
parent | [alsa] Set default sound card to first non-HDMI card (diff) | |
download | tm-scripts-adc62a87e207bfc5add709672ba031e78b309363.tar.gz tm-scripts-adc62a87e207bfc5add709672ba031e78b309363.tar.xz tm-scripts-adc62a87e207bfc5add709672ba031e78b309363.zip |
[vmchooser*] Sync vmchooser-run_virt scripts
-rwxr-xr-x | remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt | 32 | ||||
-rwxr-xr-x | remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt | 3 |
2 files changed, 19 insertions, 16 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 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/" |