1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
# loads client classes from $MCLIBDIR |
# loads client classes from $MCORE_LIBDIR |
4 |
load_client_classes() |
load_client_classes() |
5 |
{ |
{ |
6 |
|
local i |
7 |
|
|
8 |
# client specific |
# client specific |
9 |
for i in ${MCLIBDIR}/include/*.client.class |
for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class) |
10 |
do |
do |
11 |
source ${i} || eecho "error loading ${i}" |
source ${i} || eecho "error loading ${i}" |
12 |
done |
done |
102 |
mecho "\trestart - restarts the daemon" |
mecho "\trestart - restarts the daemon" |
103 |
mecho "\tstop - stops the daemon" |
mecho "\tstop - stops the daemon" |
104 |
mecho "\tnocolors - disable colors, useful for the webclient" |
mecho "\tnocolors - disable colors, useful for the webclient" |
105 |
|
mecho "\tcolors - enable colors" |
106 |
mecho "\tquiet - do not print any unecessary messages" |
mecho "\tquiet - do not print any unecessary messages" |
107 |
mecho "\thelp - shows help" |
mecho "\thelp - shows help" |
108 |
|
mecho "\tversion - prints version of the daemon" |
109 |
mecho "\tquit - quits the connection to the server" |
mecho "\tquit - quits the connection to the server" |
110 |
mecho |
mecho |
111 |
mecho "Help topics:" |
mecho "Help topics:" |
226 |
# show missing and set the right retval |
# show missing and set the right retval |
227 |
if [[ -z ${missing} ]] |
if [[ -z ${missing} ]] |
228 |
then |
then |
229 |
rvecho "${sorted}" |
# do not escape, or CRLFS get printed to screen too |
230 |
|
rvecho ${sorted} |
231 |
return 0 |
return 0 |
232 |
else |
else |
233 |
for req in ${sorted} |
for req in ${sorted} |
235 |
if no_duplicate "${missing}" "$req" |
if no_duplicate "${missing}" "$req" |
236 |
then |
then |
237 |
# print normal |
# print normal |
238 |
rvecho -n " ${req}" |
rvecho -n "${req} " |
239 |
else |
else |
240 |
# print missing |
# print missing |
241 |
eecho -n " ${req}" |
eecho -n "${req} " |
242 |
fi |
fi |
243 |
done |
done |
244 |
|
# print CRLF |
245 |
|
echo |
246 |
return 1 |
return 1 |
247 |
fi |
fi |
248 |
} |
} |
371 |
# every thing went ok, directory not empty |
# every thing went ok, directory not empty |
372 |
return 0 |
return 0 |
373 |
} |
} |
374 |
|
|
375 |
|
help_daemon_mroot() |
376 |
|
{ |
377 |
|
mecho "get daemon.mroot" |
378 |
|
mecho " Prints current MROOT variable." |
379 |
|
mecho |
380 |
|
mecho "set daemon.mroot [path]" |
381 |
|
mecho " set MROOT variable to given path." |
382 |
|
} |
383 |
|
|
384 |
|
get_daemon_mroot() |
385 |
|
{ |
386 |
|
rvecho "${MROOT}" |
387 |
|
} |
388 |
|
|
389 |
|
set_daemon_mroot() |
390 |
|
{ |
391 |
|
local path=$1 |
392 |
|
|
393 |
|
if [[ -d ${path} ]] |
394 |
|
then |
395 |
|
export MROOT="${path}" |
396 |
|
decho "MROOT='${MROOT}' is set." |
397 |
|
else |
398 |
|
eecho "Path '${path}' does not exist. MROOT not set." |
399 |
|
fi |
400 |
|
} |
401 |
|
|
402 |
|
list_files_in_directory() |
403 |
|
{ |
404 |
|
local i |
405 |
|
local retval |
406 |
|
local path |
407 |
|
local opts |
408 |
|
local type |
409 |
|
|
410 |
|
# basic getops |
411 |
|
for i in $* |
412 |
|
do |
413 |
|
case $1 in |
414 |
|
-mindepth) shift; opts+=" -mindepth $1" ;; |
415 |
|
-maxdepth) shift; opts+=" -maxdepth $1" ;; |
416 |
|
-type) shift; type="$1" ;; |
417 |
|
-name) shift; opts+=" -name $1" ;; |
418 |
|
'') continue ;; |
419 |
|
*) path="$1" ;; |
420 |
|
esac |
421 |
|
shift |
422 |
|
done |
423 |
|
|
424 |
|
if [[ -z ${path} ]] |
425 |
|
then |
426 |
|
eecho "No path given." |
427 |
|
return 1 |
428 |
|
fi |
429 |
|
|
430 |
|
if [[ ! -d ${path} ]] |
431 |
|
then |
432 |
|
eecho "Directory '${path}' does not exist." |
433 |
|
return 1 |
434 |
|
fi |
435 |
|
|
436 |
|
# default to files |
437 |
|
[[ -z ${type} ]] && type=f |
438 |
|
|
439 |
|
for i in $(find ${path} ${opts} -type ${type} -printf '%f\n' | sort) |
440 |
|
do |
441 |
|
if [[ -z ${retval} ]] |
442 |
|
then |
443 |
|
retval="${i}" |
444 |
|
else |
445 |
|
retval+=" ${i}" |
446 |
|
fi |
447 |
|
done |
448 |
|
|
449 |
|
rvecho "${retval}" |
450 |
|
} |
451 |
|
|
452 |
|
print_version() |
453 |
|
{ |
454 |
|
echo "mcored-$(<${MCORE_LIBDIR}/VERSION)" |
455 |
|
} |
456 |
|
|
457 |
|
system_chroot() |
458 |
|
{ |
459 |
|
local cmd="$@" |
460 |
|
if [[ -z ${MROOT} ]] |
461 |
|
then |
462 |
|
echo "system_chroot(): \$MROOT was not set, doing nothing!" |
463 |
|
return 1 |
464 |
|
fi |
465 |
|
if [ ! -d ${MROOT} ] |
466 |
|
then |
467 |
|
eecho "system_chroot(): MROOT='${MROOT}' does not exist." |
468 |
|
return 1 |
469 |
|
fi |
470 |
|
|
471 |
|
chroot ${MROOT} ${cmd} |
472 |
|
} |
473 |
|
|