--- mcore-src/trunk/mcore-tools/daemon/include/daemon.global.class 2012/08/13 11:42:52 2030 +++ mcore-src/trunk/mcore-tools/daemon/include/daemon.global.class 2014/01/10 10:23:50 2139 @@ -1,12 +1,12 @@ # $Id$ -# loads client classes from $MCLIBDIR +# loads client classes from $MCORE_LIBDIR load_client_classes() { local i # client specific - for i in $(find ${MCLIBDIR}/include -type f -name \*.client.class) + for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class) do source ${i} || eecho "error loading ${i}" done @@ -105,6 +105,7 @@ 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:" @@ -225,7 +226,8 @@ # show missing and set the right retval if [[ -z ${missing} ]] then - rvecho "${sorted}" + # do not escape, or CRLFS get printed to screen too + rvecho ${sorted} return 0 else for req in ${sorted} @@ -233,12 +235,14 @@ if no_duplicate "${missing}" "$req" then # print normal - rvecho -n " ${req}" + rvecho -n "${req} " else # print missing - eecho -n " ${req}" + eecho -n "${req} " fi done + # print CRLF + echo return 1 fi } @@ -410,6 +414,7 @@ -mindepth) shift; opts+=" -mindepth $1" ;; -maxdepth) shift; opts+=" -maxdepth $1" ;; -type) shift; type="$1" ;; + -name) shift; opts+=" -name $1" ;; '') continue ;; *) path="$1" ;; esac @@ -431,15 +436,38 @@ # default to files [[ -z ${type} ]] && type=f - for i in $(find ${path} ${opts} -type ${type} | sort) + for i in $(find ${path} ${opts} -type ${type} -printf '%f\n' | sort) do if [[ -z ${retval} ]] then - retval="$(basename ${i})" + retval="${i}" else - retval="${retval} $(basename ${i})" + retval+=" ${i}" fi done rvecho "${retval}" } + +print_version() +{ + echo "mcored-$(<${MCORE_LIBDIR}/VERSION)" +} + +system_chroot() +{ + local cmd="$@" + if [[ -z ${MROOT} ]] + then + echo "system_chroot(): \$MROOT was not set, doing nothing!" + return 1 + fi + if [ ! -d ${MROOT} ] + then + eecho "system_chroot(): MROOT='${MROOT}' does not exist." + return 1 + fi + + chroot ${MROOT} ${cmd} +} +