Magellan Linux

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

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

mcore-src/trunk/mcore-tools/daemon/client/mcored.sh revision 1248 by niro, Wed Feb 2 20:20:24 2011 UTC mcore-src/trunk/mcore-tools/src/mcored.in revision 2202 by niro, Fri Jan 10 14:50:59 2014 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  MCLIBDIR="/usr/lib/mcored"  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  # globals
12  source ${MCLIBDIR}/include/daemon.global.class  source ${MCORE_LIBDIR}/include/common.global.class
13  source ${MCLIBDIR}/include/sessionauth.global.class  source ${MCORE_LIBDIR}/include/daemon.global.class
14  source ${MCLIBDIR}/include/mysqlfunctions.global.class  source ${MCORE_LIBDIR}/include/sessionauth.global.class
15  source ${MCLIBDIR}/include/hwdetection.global.class  #source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class
16    source ${MCORE_LIBDIR}/include/hwdetection.global.class
17    
18  # client specific  # load client classes plugins
19  for i in ${MCLIBDIR}/include/*.client.class  load_client_classes
 do  
  source ${i} || echo "error loading ${i}"  
 done  
20    
21  # config settings  # config settings
22  source /etc/mcore/config.rc  source @@SYSCONFDIR@@/mcore/config.rc
23  source /etc/mcore/serial  #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  
24    
25  # if [[ ${DEBUG} = 1 ]]  # import_hardware_resource()
26  # then  # {
27  # echo "${resource}=${value}" >> /root/lala.log  # local resource="$1"
28  # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log  # local value
29  # fi  #
30  # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"  # # special cases
31    # case ${resource} in
32   import_resource status "${ALX_SERIAL}" "${resource}" "${value}"  # gfxcard) value="$(get_x11_driver_modules)" ;;
33  }  # *) value="$(get_hwinfo --with-description ${resource})" ;;
34    # esac
35    #
36    # # if [[ ${DEBUG} = 1 ]]
37    # # then
38    # # echo "${resource}=${value}" >> /root/lala.log
39    # # echo "mysqldo \"update status set ${resource}='${value}' where serial=${ALX_SERIAL};\"" >> /root/lala.log
40    # # fi
41    # # mysql_insert status,serial="${ALX_SERIAL}","${resource}"="${value}"
42    #
43    # import_resource status "${ALX_SERIAL}" "${resource}" "${value}"
44    # }
45    
46    
47  # set_init_state()  # set_init_state()
# Line 48  import_hardware_resource() Line 52  import_hardware_resource()
52  # }  # }
53    
54  DEBUG=1  DEBUG=1
55    NOCOLORS="false"
56    WEBCRLF="false"
57    QUIET="false"
58    
59  run=run  run=run
60  valid_session=no  valid_session=no
61    
62    # tell what we are
63    echo "Connected to $(print_version)"
64    
65  while [[ ${run} = run ]]  while [[ ${run} = run ]]
66  do  do
67   read line   read line
# Line 64  do Line 74  do
74   get*) run_class ${line} ;;   get*) run_class ${line} ;;
75   set*) run_class ${line} ;;   set*) run_class ${line} ;;
76   auth*) validate_auth ${line/auth /} ;;   auth*) validate_auth ${line/auth /} ;;
77   provide) print_provide ;;   provide) valid_session && print_provide ;;
78     require) valid_session && verify_requirements ;;
79     reload) valid_session && mecho "reloading client classes ..." && load_client_classes ;;
80     restart) valid_session && restart_service ;;
81     stop) valid_session && stop_service ;;
82     nocolors) export NOCOLORS="true" ;;
83     colors) export NOCOLORS="false" ;;
84     webcrlf) export WEBCRLF="true" ;;
85     quiet) export QUIET="true" ;;
86     # version does not need auth
87     version) print_version ;;
88   help*)   help*)
89   if validate_session   if valid_session
90   then   then
91   if [[ ${line} = help ]]   if [[ ${line} = help ]]
92   then   then
# Line 83  do Line 103  do
103   *)   *)
104   mecho "Unkown command '${line}'"   mecho "Unkown command '${line}'"
105   mecho "Type 'help' for more information."   mecho "Type 'help' for more information."
106   echo "$line" >> /root/lala.log   #echo "$line" >> /root/lala.log
107   ;;   ;;
108   esac   esac
109  done  done

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