diff options
author | Michael Neves | 2013-05-03 18:48:22 +0200 |
---|---|---|
committer | Michael Neves | 2013-05-03 18:48:22 +0200 |
commit | b9faedd776dbfae40c2cbc0f05b49815149f7b88 (patch) | |
tree | 47927e8797233e7ae82de2b555c1b50a5e7904d7 /remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh | |
parent | move /openslx to /opt/openslx (diff) | |
download | tm-scripts-b9faedd776dbfae40c2cbc0f05b49815149f7b88.tar.gz tm-scripts-b9faedd776dbfae40c2cbc0f05b49815149f7b88.tar.xz tm-scripts-b9faedd776dbfae40c2cbc0f05b49815149f7b88.zip |
vmchooser
Diffstat (limited to 'remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh')
-rwxr-xr-x | remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh b/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh new file mode 100755 index 00000000..ded5d114 --- /dev/null +++ b/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Copyright (c) 2007..2009 - RZ Uni FR +# Copyright (c) 2007..2011 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# xmlfilter.sh +# - This script is invoked by the vmchooser tool. It simply filters xml- +# files (taking the path to these files in $1). You might modify it in any +# way to match your needs, e.g. ask some database instead. You can re- +# implement it in any other programming language too. You simply have to +# return a list of proper xml files to be interpreted by the vmchooser +# binary). Please check for vmchooser.sh too ... +# ----------------------------------------------------------------------------- + +# This script . +# +# currently: +# - filter for slxgrp (which comes from /etc/machine-setup) +# + +# include default directories +. /etc/opt/openslx/openslx.conf + +if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf ]; then + . ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf +fi + +for FILE in $(find $1 -iname "*.xml"); do + # filter all xmls which aren't set active + if [ $(grep "<active param=.*true.*" ${FILE} | wc -l) -eq 1 ]; then + if [ -n ${vmchooser_env} ]; then + # filter all xmls with pool-param not equal to vmchooser::env + if [ $(grep "<pools param=\"${vmchooser_env}\"" ${FILE} | wc -l) -eq 1 ];\ + then + echo ${FILE}; + fi + else + # if there is no pool set, just take all available xmls + echo -e ${active} + fi + fi +done |