--- mcore-src/trunk/mcore-tools/daemon/include/daemon.global.class 2012/08/13 09:38:21 2005 +++ mcore-src/trunk/mcore-tools/daemon/include/daemon.global.class 2013/05/08 11:04:43 2044 @@ -3,8 +3,10 @@ # loads client classes from $MCLIBDIR load_client_classes() { + local i + # client specific - for i in ${MCLIBDIR}/include/*.client.class + for i in $(find ${MCLIBDIR}/include -type f -name \*.client.class) do source ${i} || eecho "error loading ${i}" done @@ -100,8 +102,10 @@ mecho "\trestart - restarts the daemon" mecho "\tstop - stops the daemon" mecho "\tnocolors - disable colors, useful for the webclient" + mecho "\tcolors - enable colors" mecho "\tquiet - do not print any unecessary messages" mecho "\thelp - shows help" + mecho "\tversion - prints version of the daemon" mecho "\tquit - quits the connection to the server" mecho mecho "Help topics:" @@ -364,3 +368,79 @@ # every thing went ok, directory not empty return 0 } + +help_daemon_mroot() +{ + mecho "get daemon.mroot" + mecho " Prints current MROOT variable." + mecho + mecho "set daemon.mroot [path]" + mecho " set MROOT variable to given path." +} + +get_daemon_mroot() +{ + rvecho "${MROOT}" +} + +set_daemon_mroot() +{ + local path=$1 + + if [[ -d ${path} ]] + then + export MROOT="${path}" + decho "MROOT='${MROOT}' is set." + else + eecho "Path '${path}' does not exist. MROOT not set." + fi +} + +list_files_in_directory() +{ + local i + local retval + local path + local opts + local type + + # basic getops + for i in $* + do + case $1 in + -mindepth) shift; opts+=" -mindepth $1" ;; + -maxdepth) shift; opts+=" -maxdepth $1" ;; + -type) shift; type="$1" ;; + '') continue ;; + *) path="$1" ;; + esac + shift + done + + if [[ -z ${path} ]] + then + eecho "No path given." + return 1 + fi + + if [[ ! -d ${path} ]] + then + eecho "Directory '${path}' does not exist." + return 1 + fi + + # default to files + [[ -z ${type} ]] && type=f + + for i in $(find ${path} ${opts} -type ${type} | sort) + do + if [[ -z ${retval} ]] + then + retval="$(basename ${i})" + else + retval="${retval} $(basename ${i})" + fi + done + + rvecho "${retval}" +}