1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
|
3 |
MCLIBDIR="/usr/lib/mcored" |
MCORE_LIBDIR="@@MCORE_LIBDIR@@" |
4 |
|
|
5 |
|
# respect system env (proxy settings etc) |
6 |
|
if [ -e @@SYSCONFDIR@@/profile ] |
7 |
|
then |
8 |
|
source @@SYSCONFDIR@@/profile |
9 |
|
fi |
10 |
|
|
11 |
# globals |
# globals |
12 |
source ${MCLIBDIR}/include/daemon.global.class |
# include function comes with common.global class |
13 |
source ${MCLIBDIR}/include/sessionauth.global.class |
source ${MCORE_LIBDIR}/include/common.global.class |
14 |
#source ${MCLIBDIR}/include/mysqlfunctions.global.class |
include ${MCORE_LIBDIR}/include/daemon.global.class |
15 |
source ${MCLIBDIR}/include/hwdetection.global.class |
include ${MCORE_LIBDIR}/include/sessionauth.global.class |
16 |
|
#include ${MCORE_LIBDIR}/include/mysqlfunctions.global.class |
17 |
|
include ${MCORE_LIBDIR}/include/hwdetection.global.class |
18 |
|
|
19 |
# client specific |
# load client classes plugins |
20 |
for i in ${MCLIBDIR}/include/*.client.class |
load_client_classes |
|
do |
|
|
source ${i} || echo "error loading ${i}" |
|
|
done |
|
21 |
|
|
22 |
# config settings |
# config settings |
23 |
source /etc/mcore/config.rc |
include @@SYSCONFDIR@@/mcore/mcore.conf |
24 |
source /etc/mcore/serial |
#source @@SYSCONFDIR@@/mcore/serial |
25 |
|
|
26 |
# import_hardware_resource() |
# import_hardware_resource() |
27 |
# { |
# { |
53 |
# } |
# } |
54 |
|
|
55 |
DEBUG=1 |
DEBUG=1 |
56 |
|
NOCOLORS="false" |
57 |
|
WEBCRLF="false" |
58 |
|
QUIET="false" |
59 |
|
|
60 |
run=run |
run=run |
61 |
valid_session=no |
valid_session=no |
62 |
|
|
63 |
|
# tell what we are |
64 |
|
echo "Connected to $(print_version)" |
65 |
|
|
66 |
while [[ ${run} = run ]] |
while [[ ${run} = run ]] |
67 |
do |
do |
68 |
read line |
read line |
75 |
get*) run_class ${line} ;; |
get*) run_class ${line} ;; |
76 |
set*) run_class ${line} ;; |
set*) run_class ${line} ;; |
77 |
auth*) validate_auth ${line/auth /} ;; |
auth*) validate_auth ${line/auth /} ;; |
78 |
provide) print_provide ;; |
provide) valid_session && print_provide ;; |
79 |
require) verify_requirements ;; |
require) valid_session && verify_requirements ;; |
80 |
|
reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;; |
81 |
|
restart) valid_session && restart_service ;; |
82 |
|
stop) valid_session && stop_service ;; |
83 |
|
nocolors) export NOCOLORS="true" ;; |
84 |
|
colors) export NOCOLORS="false" ;; |
85 |
|
webcrlf) export WEBCRLF="true" ;; |
86 |
|
quiet) export QUIET="true" ;; |
87 |
|
# version does not need auth |
88 |
|
version) print_version ;; |
89 |
help*) |
help*) |
90 |
if validate_session |
if valid_session |
91 |
then |
then |
92 |
if [[ ${line} = help ]] |
if [[ ${line} = help ]] |
93 |
then |
then |
102 |
;; |
;; |
103 |
|
|
104 |
*) |
*) |
105 |
mecho "Unkown command '${line}'" |
mecho "Unknown command '${line}'" |
106 |
mecho "Type 'help' for more information." |
mecho "Type 'help' for more information." |
107 |
echo "$line" >> /root/lala.log |
#echo "$line" >> /root/lala.log |
108 |
;; |
;; |
109 |
esac |
esac |
110 |
done |
done |