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

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