Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/mcored.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2258 by niro, Mon Jan 13 14:25:18 2014 UTC revision 2446 by niro, Thu Sep 3 13:39:08 2015 UTC
# Line 14  source ${MCORE_LIBDIR}/include/common.gl Line 14  source ${MCORE_LIBDIR}/include/common.gl
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/mysqlfunctions.global.class
17    include ${MCORE_LIBDIR}/include/register.global.class
18  include ${MCORE_LIBDIR}/include/hwdetection.global.class  include ${MCORE_LIBDIR}/include/hwdetection.global.class
19    
20  # load client classes plugins  # load client classes plugins
21  load_client_classes  load_classes client
22    
23  # config settings  # config settings
24  include @@SYSCONFDIR@@/mcore/mcore.conf  include @@SYSCONFDIR@@/mcore/mcore.conf
# Line 57  NOCOLORS="false" Line 58  NOCOLORS="false"
58  WEBCRLF="false"  WEBCRLF="false"
59  QUIET="false"  QUIET="false"
60    
61    # argvs are global variables - this fixes issues with whitespaces
62    # global argvs, the whole command line
63    export GLOBAL_ARGV
64    # class specific argvs which are given to the class as parameters
65    export CLASS_ARGV
66    
67  run=run  run=run
68  valid_session=no  valid_session=no
69    
# Line 65  echo "Connected to $(print_version)" Line 72  echo "Connected to $(print_version)"
72    
73  while [[ ${run} = run ]]  while [[ ${run} = run ]]
74  do  do
75     # use an echo here not read -p '>' because sslsvd ignores the prompt pattern
76     echo -n '> '
77   read line   read line
78     eval "GLOBAL_ARGV=( ${line} )"
79    
80   case ${line} in   case ${GLOBAL_ARGV[0]} in
81   quit) run=quit ;;   quit) run=quit ;;
82    
83   # only react on the globals -> import|get|set|auth   # only react on the globals -> import|get|set|auth
84   import*) run_class ${line} ;;   import) run_class ;;
85   get*) run_class ${line} ;;   get) run_class ;;
86   set*) run_class ${line} ;;   set) run_class ;;
87   auth*) validate_auth ${line/auth /} ;;   auth) validate_auth ${GLOBAL_ARGV[*]:1} ;;
88     certauth) validate_auth_certificate ${GLOBAL_ARGV[*]:1} ;;
89     register) valid_session && register_client_local ${GLOBAL_ARGV[*]:1} ;;
90   provide) valid_session && print_provide ;;   provide) valid_session && print_provide ;;
91   require) valid_session && verify_requirements ;;   require) valid_session && verify_requirements ;;
92   reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;   reload) valid_session && mecho "reloading client classes ..." && load_classes client ;;
93   restart) valid_session && restart_service ;;   restart) valid_session && restart_service ;;
94   stop) valid_session && stop_service ;;   stop) valid_session && stop_service ;;
95   nocolors) export NOCOLORS="true" ;;   nocolors) export NOCOLORS="true" ;;
# Line 86  do Line 98  do
98   quiet) export QUIET="true" ;;   quiet) export QUIET="true" ;;
99   # version does not need auth   # version does not need auth
100   version) print_version ;;   version) print_version ;;
101   help*)   help)
102   if valid_session   if valid_session
103   then   then
104   if [[ ${line} = help ]]   if [[ ${line} = help ]]
# Line 98  do Line 110  do
110   else   else
111   mecho "You must authenticate yourself first!"   mecho "You must authenticate yourself first!"
112   mecho "  auth [username] [password]"   mecho "  auth [username] [password]"
113     mecho "or"
114     mecho "  certauth [certificate fingerprint]"
115   fi   fi
116   ;;   ;;
117    
# Line 107  do Line 121  do
121   #echo "$line" >> /root/lala.log   #echo "$line" >> /root/lala.log
122   ;;   ;;
123   esac   esac
124    
125     # unset argvs to be safe
126     unset GLOBAL_ARGS
127     unset CLASS_ARGS
128  done  done

Legend:
Removed from v.2258  
changed lines
  Added in v.2446