13 |
source ${MCORE_LIBDIR}/include/common.global.class |
source ${MCORE_LIBDIR}/include/common.global.class |
14 |
include ${MCORE_LIBDIR}/include/daemon.global.class |
include ${MCORE_LIBDIR}/include/daemon.global.class |
15 |
include ${MCORE_LIBDIR}/include/sessionauth.global.class |
include ${MCORE_LIBDIR}/include/sessionauth.global.class |
16 |
#include ${MCORE_LIBDIR}/include/mysqlfunctions.global.class |
include ${MCORE_LIBDIR}/include/register.global.class |
17 |
include ${MCORE_LIBDIR}/include/hwdetection.global.class |
include ${MCORE_LIBDIR}/include/hwdetection.global.class |
18 |
|
|
19 |
# load client classes plugins |
# load client classes plugins |
21 |
|
|
22 |
# config settings |
# config settings |
23 |
include @@SYSCONFDIR@@/mcore/mcore.conf |
include @@SYSCONFDIR@@/mcore/mcore.conf |
|
#source @@SYSCONFDIR@@/mcore/serial |
|
|
|
|
|
# import_hardware_resource() |
|
|
# { |
|
|
# local resource="$1" |
|
|
# local value |
|
|
# |
|
|
# # special cases |
|
|
# case ${resource} in |
|
|
# gfxcard) value="$(get_x11_driver_modules)" ;; |
|
|
# *) value="$(get_hwinfo --with-description ${resource})" ;; |
|
|
# esac |
|
|
# |
|
|
# # if [[ ${DEBUG} = 1 ]] |
|
|
# # then |
|
|
# # echo "${resource}=${value}" >> /root/lala.log |
|
|
# # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log |
|
|
# # fi |
|
|
# # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}" |
|
|
# |
|
|
# import_resource status "${ALX_SERIAL}" "${resource}" "${value}" |
|
|
# } |
|
|
|
|
|
|
|
|
# set_init_state() |
|
|
# { |
|
|
# local ip |
|
|
# ip=$(ifconfig | grep -A1 eth0 | grep inet | sed 's/.*inet\ addr:\(.*\) Bcast.*/\1/;') |
|
|
# |
|
|
# } |
|
24 |
|
|
25 |
|
# 0=false, 1=true |
26 |
DEBUG=1 |
DEBUG=1 |
27 |
NOCOLORS="false" |
NOCOLORS=0 |
28 |
WEBCRLF="false" |
WEBCRLF=0 |
29 |
QUIET="false" |
QUIET=0 |
30 |
|
# daemon silent mode, read from env |
31 |
|
: ${SILENT=0} |
32 |
|
|
33 |
# argvs are global variables - this fixes issues with whitespaces |
# argvs are global variables - this fixes issues with whitespaces |
34 |
# global argvs, the whole command line |
# global argvs, the whole command line |
40 |
valid_session=no |
valid_session=no |
41 |
|
|
42 |
# tell what we are |
# tell what we are |
43 |
echo "Connected to $(print_version)" |
[[ ${SILENT} = 1 ]] || echo "Connected to $(print_version)" |
44 |
|
|
45 |
while [[ ${run} = run ]] |
while [[ ${run} = run ]] |
46 |
do |
do |
47 |
# use an echo here not read -p '>' because sslsvd ignores the prompt pattern |
# use an echo here not read -p '>' because sslsvd ignores the prompt pattern |
48 |
echo -n '> ' |
[[ ${SILENT} = 1 ]] || echo -n '> ' |
49 |
read line |
read line |
50 |
eval "GLOBAL_ARGV=( ${line} )" |
eval "GLOBAL_ARGV=( ${line} )" |
51 |
|
|
58 |
set) run_class ;; |
set) run_class ;; |
59 |
auth) validate_auth ${GLOBAL_ARGV[*]:1} ;; |
auth) validate_auth ${GLOBAL_ARGV[*]:1} ;; |
60 |
certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;; |
certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;; |
61 |
|
register) valid_session && register_client_local ${GLOBAL_ARGV[*]:1} ;; |
62 |
provide) valid_session && print_provide ;; |
provide) valid_session && print_provide ;; |
63 |
require) valid_session && verify_requirements ;; |
require) valid_session && verify_requirements ;; |
64 |
reload) valid_session && mecho "reloading client classes ..." && load_classes client ;; |
reload) valid_session && mecho "reloading client classes ..." && load_classes client ;; |
65 |
restart) valid_session && restart_service ;; |
restart) valid_session && restart_service ;; |
66 |
stop) valid_session && stop_service ;; |
stop) valid_session && stop_service ;; |
67 |
nocolors) export NOCOLORS="true" ;; |
nocolors) export NOCOLORS=1 ;; |
68 |
colors) export NOCOLORS="false" ;; |
colors) export NOCOLORS=0 ;; |
69 |
webcrlf) export WEBCRLF="true" ;; |
webcrlf) export WEBCRLF=1 ;; |
70 |
quiet) export QUIET="true" ;; |
quiet) export QUIET=1 ;; |
71 |
# version does not need auth |
# version does not need auth |
72 |
version) print_version ;; |
version) print_version ;; |
73 |
help) |
help) |
82 |
else |
else |
83 |
mecho "You must authenticate yourself first!" |
mecho "You must authenticate yourself first!" |
84 |
mecho " auth [username] [password]" |
mecho " auth [username] [password]" |
85 |
|
mecho "or" |
86 |
|
mecho " certauth [certificate fingerprint]" |
87 |
fi |
fi |
88 |
;; |
;; |
89 |
|
|