Magellan Linux

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

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

revision 1248 by niro, Wed Feb 2 20:20:24 2011 UTC revision 2052 by niro, Wed May 8 11:20:11 2013 UTC
# Line 5  MCLIBDIR="/usr/lib/mcored" Line 5  MCLIBDIR="/usr/lib/mcored"
5  # globals  # globals
6  source ${MCLIBDIR}/include/daemon.global.class  source ${MCLIBDIR}/include/daemon.global.class
7  source ${MCLIBDIR}/include/sessionauth.global.class  source ${MCLIBDIR}/include/sessionauth.global.class
8  source ${MCLIBDIR}/include/mysqlfunctions.global.class  #source ${MCLIBDIR}/include/mysqlfunctions.global.class
9  source ${MCLIBDIR}/include/hwdetection.global.class  source ${MCLIBDIR}/include/hwdetection.global.class
10    
11  # client specific  # load client classes plugins
12  for i in ${MCLIBDIR}/include/*.client.class  load_client_classes
 do  
  source ${i} || echo "error loading ${i}"  
 done  
13    
14  # config settings  # config settings
15  source /etc/mcore/config.rc  source /etc/mcore/config.rc
16  source /etc/mcore/serial  #source /etc/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  
17    
18  # if [[ ${DEBUG} = 1 ]]  # import_hardware_resource()
19  # then  # {
20  # echo "${resource}=${value}" >> /root/lala.log  # local resource="$1"
21  # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log  # local value
22  # fi  #
23  # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"  # # special cases
24    # case ${resource} in
25   import_resource status "${ALX_SERIAL}" "${resource}" "${value}"  # gfxcard) value="$(get_x11_driver_modules)" ;;
26  }  # *) value="$(get_hwinfo --with-description ${resource})" ;;
27    # esac
28    #
29    # # if [[ ${DEBUG} = 1 ]]
30    # # then
31    # # echo "${resource}=${value}" >> /root/lala.log
32    # # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log
33    # # fi
34    # # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"
35    #
36    # import_resource status "${ALX_SERIAL}" "${resource}" "${value}"
37    # }
38    
39    
40  # set_init_state()  # set_init_state()
# Line 48  import_hardware_resource() Line 45  import_hardware_resource()
45  # }  # }
46    
47  DEBUG=1  DEBUG=1
48    NOCOLORS="false"
49    WEBCRLF="false"
50    QUIET="false"
51    
52  run=run  run=run
53  valid_session=no  valid_session=no
54    
55    # tell what we are
56    echo "Connected to $(print_version)"
57    
58  while [[ ${run} = run ]]  while [[ ${run} = run ]]
59  do  do
60   read line   read line
# Line 64  do Line 67  do
67   get*) run_class ${line} ;;   get*) run_class ${line} ;;
68   set*) run_class ${line} ;;   set*) run_class ${line} ;;
69   auth*) validate_auth ${line/auth /} ;;   auth*) validate_auth ${line/auth /} ;;
70   provide) print_provide ;;   provide) valid_session && print_provide ;;
71     require) valid_session && verify_requirements ;;
72     reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
73     restart) valid_session && restart_service ;;
74     stop) valid_session && stop_service ;;
75     nocolors) export NOCOLORS="true" ;;
76     colors) export NOCOLORS="false" ;;
77     webcrlf) export WEBCRLF="true" ;;
78     quiet) export QUIET="true" ;;
79     # version does not need auth
80     version) print_version ;;
81   help*)   help*)
82   if validate_session   if valid_session
83   then   then
84   if [[ ${line} = help ]]   if [[ ${line} = help ]]
85   then   then
# Line 83  do Line 96  do
96   *)   *)
97   mecho "Unkown command '${line}'"   mecho "Unkown command '${line}'"
98   mecho "Type 'help' for more information."   mecho "Type 'help' for more information."
99   echo "$line" >> /root/lala.log   #echo "$line" >> /root/lala.log
100   ;;   ;;
101   esac   esac
102  done  done

Legend:
Removed from v.1248  
changed lines
  Added in v.2052