1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
|
# loads client classes from $MCLIBDIR |
4 |
|
load_client_classes() |
5 |
|
{ |
6 |
|
# client specific |
7 |
|
for i in ${MCLIBDIR}/include/*.client.class |
8 |
|
do |
9 |
|
source ${i} || eecho "error loading ${i}" |
10 |
|
done |
11 |
|
} |
12 |
|
|
13 |
|
# restarts the whole service via remote cmd |
14 |
|
restart_service() |
15 |
|
{ |
16 |
|
local pid |
17 |
|
for pid in $(pidof sslsvd) |
18 |
|
do |
19 |
|
kill -SIGHUP ${pid} |
20 |
|
done |
21 |
|
} |
22 |
|
|
23 |
|
# stops the whole service via remote cmd |
24 |
|
stop_service() |
25 |
|
{ |
26 |
|
local pid |
27 |
|
for pid in $(pidof sslsvd) |
28 |
|
do |
29 |
|
kill -15 ${pid} |
30 |
|
sleep 1 |
31 |
|
kill -9 ${pid} |
32 |
|
done |
33 |
|
} |
34 |
|
|
35 |
# # import_resource $table $serial $resource $value |
# # import_resource $table $serial $resource $value |
36 |
# import_resource() |
# import_resource() |
37 |
# { |
# { |
96 |
mecho "\tauth - authenticate to the daemon" |
mecho "\tauth - authenticate to the daemon" |
97 |
mecho "\tprovide - shows provides of a system" |
mecho "\tprovide - shows provides of a system" |
98 |
mecho "\trequire - verify plugin requirements" |
mecho "\trequire - verify plugin requirements" |
99 |
|
mecho "\treload - reloads all client classes plugins" |
100 |
|
mecho "\trestart - restarts the daemon" |
101 |
|
mecho "\tstop - stops the daemon" |
102 |
mecho "\tnocolors - disable colors, useful for the webclient" |
mecho "\tnocolors - disable colors, useful for the webclient" |
103 |
|
mecho "\tcolors - enable colors" |
104 |
mecho "\tquiet - do not print any unecessary messages" |
mecho "\tquiet - do not print any unecessary messages" |
105 |
mecho "\thelp - shows help" |
mecho "\thelp - shows help" |
106 |
mecho "\tquit - quits the connection to the server" |
mecho "\tquit - quits the connection to the server" |
122 |
# on newer xorg-servers root is not allowed to run progs in a user session |
# on newer xorg-servers root is not allowed to run progs in a user session |
123 |
x11runas() |
x11runas() |
124 |
{ |
{ |
125 |
if pidof X |
if [[ -n $(pidof X) ]] |
126 |
then |
then |
127 |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@" |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@" |
128 |
fi |
fi |
265 |
# sort them alpabetically |
# sort them alpabetically |
266 |
sorted=$(for i in ${PROVIDE}; do echo "${i}"; done | sort) |
sorted=$(for i in ${PROVIDE}; do echo "${i}"; done | sort) |
267 |
# do not escape, or CRLFS get printed to screen too |
# do not escape, or CRLFS get printed to screen too |
268 |
rvecho ${sorted} |
rvecho ${sorted} |
269 |
} |
} |
270 |
|
|
271 |
# message only echo | disabled in quiet mode |
# message only echo | disabled in quiet mode |
365 |
# every thing went ok, directory not empty |
# every thing went ok, directory not empty |
366 |
return 0 |
return 0 |
367 |
} |
} |
368 |
|
|
369 |
|
help_daemon_mroot() |
370 |
|
{ |
371 |
|
mecho "get daemon.mroot" |
372 |
|
mecho " Prints current MROOT variable." |
373 |
|
mecho |
374 |
|
mecho "set daemon.mroot [path]" |
375 |
|
mecho " set MROOT variable to given path." |
376 |
|
} |
377 |
|
|
378 |
|
get_daemon_mroot() |
379 |
|
{ |
380 |
|
rvecho "${MROOT}" |
381 |
|
} |
382 |
|
|
383 |
|
set_daemon_mroot() |
384 |
|
{ |
385 |
|
local path=$1 |
386 |
|
|
387 |
|
if [[ -d ${path} ]] |
388 |
|
then |
389 |
|
export MROOT="${path}" |
390 |
|
decho "MROOT='${MROOT}' is set." |
391 |
|
else |
392 |
|
eecho "Path '${path}' does not exist. MROOT not set." |
393 |
|
fi |
394 |
|
} |
395 |
|
|
396 |
|
list_files_in_directory() |
397 |
|
{ |
398 |
|
local i |
399 |
|
local retval |
400 |
|
local path |
401 |
|
local opts |
402 |
|
local type |
403 |
|
|
404 |
|
# basic getops |
405 |
|
for i in $* |
406 |
|
do |
407 |
|
case $1 in |
408 |
|
-mindepth) shift; opts+=" -mindepth $1" ;; |
409 |
|
-maxdepth) shift; opts+=" -maxdepth $1" ;; |
410 |
|
-type) shift; type="$1" ;; |
411 |
|
'') continue ;; |
412 |
|
*) path="$1" ;; |
413 |
|
esac |
414 |
|
shift |
415 |
|
done |
416 |
|
|
417 |
|
if [[ -z ${path} ]] |
418 |
|
then |
419 |
|
eecho "No path given." |
420 |
|
return 1 |
421 |
|
fi |
422 |
|
|
423 |
|
if [[ ! -d ${path} ]] |
424 |
|
then |
425 |
|
eecho "Directory '${path}' does not exist." |
426 |
|
return 1 |
427 |
|
fi |
428 |
|
|
429 |
|
# default to files |
430 |
|
[[ -z ${type} ]] && type=f |
431 |
|
|
432 |
|
for i in $(find ${path} ${opts} -type ${type} | sort) |
433 |
|
do |
434 |
|
if [[ -z ${retval} ]] |
435 |
|
then |
436 |
|
retval="$(basename ${i})" |
437 |
|
else |
438 |
|
retval="${retval} $(basename ${i})" |
439 |
|
fi |
440 |
|
done |
441 |
|
|
442 |
|
rvecho "${retval}" |
443 |
|
} |