diff options
| author | Simon Rettberg | 2014-04-01 15:35:03 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2014-04-01 15:35:03 +0200 |
| commit | 926035c0f0b1a7e8062202229f97f0fd659f14db (patch) | |
| tree | 5b03f334f63e15fbf057d634223b8913d98392f0 /remote | |
| parent | [stage31] Support for KCL-switches nvidia and amd, which unconditionally load... (diff) | |
| download | tm-scripts-926035c0f0b1a7e8062202229f97f0fd659f14db.tar.gz tm-scripts-926035c0f0b1a7e8062202229f97f0fd659f14db.tar.xz tm-scripts-926035c0f0b1a7e8062202229f97f0fd659f14db.zip | |
[vmware/vmchooser] Generalize string cleaning function
Diffstat (limited to 'remote')
| -rwxr-xr-x | remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt | 12 | ||||
| -rw-r--r-- | remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include | 13 |
2 files changed, 13 insertions, 12 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 2cd92776..dd6cd84e 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -70,6 +70,15 @@ cleanexit () { exit 129 # No exit code was given :/ } +function rv_clean_string () +{ + if [ "$#" -ge 1 ]; then + echo "$@" | tr '[A-Z]' '[a-z]' | tr -d -c '[a-z0-9]' + else + tr '[A-Z]' '[a-z]' | tr -d -c '[a-z0-9]' + fi +} + trap cleanexit SIGINT SIGTERM # check for important files used @@ -221,6 +230,7 @@ writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c" writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')" writelog "\tVM XML dir:\t\t$(dirname "${xmlfile}")" writelog "\tXML file:\t\t${xmlfile}" +writelog "Enable 3D:\t\t${enable3d}" writelog "VM config:" # Name of the virt image @@ -405,7 +415,7 @@ remotedesktopport="590${VM_ID}" # Enable 3D -enable3d=$(grep -i "<enable3d param=.*" ${xmlfile} 2>/dev/null | awk -F '=' '{print $2}' | tr "[A-Z]" "[a-z]") +enable3d=$(grep -i -o "<enable3d param=.*" "${xmlfile}" | awk -F '"' '{print $2}' | rv_clean_string) # Add rw share sharepath="${HOME}/PERSISTENT" 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 3933287b..d9a47054 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 @@ -18,16 +18,7 @@ ### configuration writer functions ################################################################################ -function clean_string () -{ - if [ "$#" -ge 1 ]; then - echo "$@" | tr '[A-Z]' '[a-z]' | tr -d '\t _./' - else - cat - | tr '[A-Z]' '[a-z]' | tr -d '\t _./' - fi -} - -vmostype=$(clean_string "$vmostype") +vmostype=$(rv_clean_string "$vmostype") runvmwareconfheader () { @@ -466,7 +457,7 @@ esac sound="es1371" # check for 3D configuration setting -case "$(clean_string "$enable3d")" in +case "$enable3d" in true|yes) enable3d="TRUE" ;; |
