Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/mcore-controld.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2470 - (show annotations) (download)
Tue Sep 8 08:30:10 2015 UTC (8 years, 7 months ago) by niro
File size: 2644 byte(s)
-include control.global.class
1 #!/bin/sh
2
3 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
12 # include function comes with common.global class
13 source ${MCORE_LIBDIR}/include/common.global.class
14 include ${MCORE_LIBDIR}/include/daemon.global.class
15 include ${MCORE_LIBDIR}/include/sessionauth.global.class
16 include ${MCORE_LIBDIR}/include/mysqlfunctions.global.class
17 include ${MCORE_LIBDIR}/include/register.global.class
18 include ${MCORE_LIBDIR}/include/control.global.class
19 #include ${MCORE_LIBDIR}/include/hwdetection.global.class
20
21 # load control classes plugins
22 load_classes control
23
24 # config settings
25 include @@SYSCONFDIR@@/mcore/mcore.conf
26
27 SQL_USER=alx_install
28 SQL_PASS=@lx
29 SQL_HOST=localhost
30 SQL_DB=alx_web
31
32 DEBUG=1
33 NOCOLORS="false"
34 WEBCRLF="false"
35 QUIET="false"
36
37 # argvs are global variables - this fixes issues with whitespaces
38 # global argvs, the whole command line
39 export GLOBAL_ARGV
40 # class specific argvs which are given to the class as parameters
41 export CLASS_ARGV
42
43 run=run
44 valid_session=no
45
46 # tell what we are
47 echo "Connected to $(print_version)"
48
49 while [[ ${run} = run ]]
50 do
51 # use an echo here not read -p '>' because sslsvd ignores the prompt pattern
52 echo -n '> '
53 read line
54 eval "GLOBAL_ARGV=( ${line} )"
55
56 case ${GLOBAL_ARGV[0]} in
57 quit) run=quit ;;
58
59 # only react on the globals -> import|get|set|auth
60 import) run_class ;;
61 control) run_class ;;
62 get) run_class ;;
63 set) run_class ;;
64 auth) validate_auth ${GLOBAL_ARGV[*]:1} ;;
65 certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;;
66 register) valid_session && validate_client ${GLOBAL_ARGV[*]:1} ;;
67 provide) valid_session && print_provide ;;
68 require) valid_session && verify_requirements ;;
69 reload) valid_session && mecho "reloading client classes ..." && load_classes client ;;
70 restart) valid_session && restart_service ;;
71 stop) valid_session && stop_service ;;
72 nocolors) export NOCOLORS="true" ;;
73 colors) export NOCOLORS="false" ;;
74 webcrlf) export WEBCRLF="true" ;;
75 quiet) export QUIET="true" ;;
76 # version does not need auth
77 version) print_version ;;
78 help)
79 if valid_session
80 then
81 if [[ ${line} = help ]]
82 then
83 help_topics
84 else
85 run_class ${line}
86 fi
87 else
88 mecho "You must authenticate yourself first!"
89 mecho " auth [username] [password]"
90 mecho "or"
91 mecho " certauth [certificate fingerprint]"
92 fi
93 ;;
94
95 *)
96 mecho "Unknown command '${line}'"
97 mecho "Type 'help' for more information."
98 #echo "$line" >> /root/lala.log
99 ;;
100 esac
101
102 # unset argvs to be safe
103 unset GLOBAL_ARGS
104 unset CLASS_ARGS
105 done

Properties

Name Value
svn:executable *