Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in

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

revision 2495 by niro, Thu Sep 10 13:50:46 2015 UTC revision 2508 by niro, Mon Sep 14 07:31:35 2015 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3    provide hardware
4  require hwdetection  require hwdetection
5  require mysql  require mysql
6    
7  set_hardware_detect()  run_hardware_detect()
8  {  {
9   local serial="${CLASS_ARGV[0]}"   local serial="$1"
10    
11   local cmd   local cmd
12   local netcard_driver   local netcard_driver
13     local networking
14     local hostname
15     local domain
16   local graphic_driver   local graphic_driver
17   local monitor_info   local monitor_info
18   local monitor_resolution   local monitor_resolution
19     local keymap
20     local hwdetected
21     local auth
22     local i
23    
24     if [[ -z ${serial} ]]
25     then
26     decho "No serial given"
27     return 1
28     fi
29    
30     # first check if hardware detect was already done
31     hwdetected=$(mysqldo "select hwdetected from client_serials where serial=${serial};")
32     if [[ ${hwdetected} = 1 ]]
33     then
34     decho "hardware detection already run, aborting"
35     return 0
36     else
37     decho "running hardware detection"
38     fi
39    
40   nsslsay_queue_init   nsslsay_queue_init
41   nsslsay_queue_add "nocolors"   nsslsay_queue_add "nocolors"
# Line 24  set_hardware_detect() Line 48  set_hardware_detect()
48   else   else
49   decho "no netcard_driver found"   decho "no netcard_driver found"
50   fi   fi
51   if [[ -z $(mysqldo "select networking from cfg_network where serial=${serial};") ]]   networking=$(mysqldo "select networking from cfg_network where serial=${serial};")
52     if [[ -z ${networking} ]] || [[ ${networking} = NULL ]]
53   then   then
54   # set network to dhcp   # set network to dhcp
55   decho "networking='dhcp'"   decho "networking='dhcp'"
56   import_resource cfg_network "${serial}" networking "dhcp"   import_resource cfg_network "${serial}" networking "dhcp"
57   fi   fi
58   if [[ -z $(mysqldo "select hostname from cfg_network where serial=${serial};") ]]   hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};")
59     if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]]
60   then   then
61   # set hostname to MCORE_DEFAULT_HOSTNAME   # set hostname to MCORE_DEFAULT_HOSTNAME
62   decho "hostname='${MCORE_DEFAULT_HOSTNAME}'"   decho "hostname='${MCORE_DEFAULT_HOSTNAME}'"
63   import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}"   import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}"
64   fi   fi
65   if [[ -z $(mysqldo "select domain from cfg_network where serial=${serial};") ]]   domain=$(mysqldo "select domain from cfg_network where serial=${serial};")
66     if [[ -z ${domain} ]] || [[ ${domain} = NULL ]]
67   then   then
68   # set domain to MCORE_DEFAULT_DOMAIN   # set domain to MCORE_DEFAULT_DOMAIN
69   decho "hostname='${MCORE_DEFAULT_DOMAIN}'"   decho "hostname='${MCORE_DEFAULT_DOMAIN}'"
# Line 67  set_hardware_detect() Line 94  set_hardware_detect()
94   else   else
95   decho "no monitor_resolution found"   decho "no monitor_resolution found"
96   fi   fi
97    
98     keymap=$(mysqldo "select keymap from cfg_input where serial=${serial};")
99     if [[ -z ${keymap} ]] || [[ ${keymap} = NULL ]]
100     then
101     # set keymap to MCORE_DEFAULT_KEYMAP
102     decho "keymap='${MCORE_DEFAULT_KEYMAP}'"
103     import_resource cfg_input "${serial}" keymap "${MCORE_DEFAULT_KEYMAP}"
104     fi
105    
106     # now setup some empty database entries if the does not exist
107     for i in user root vnc
108     do
109     auth=$(mysqldo "select ${i} from client_auth where serial=${serial};")
110     if [[ -z ${auth} ]] || [[ ${auth} = NULL ]]
111     then
112     decho "set empty ${i} pass"
113     import_resource client_auth "${serial}" "${i}" ""
114     fi
115     done
116    
117     # create an empty screensaver entry
118     decho "set empty screensaver"
119     import_resource cfg_screensaver "${serial}" "screensaver" ""
120    
121     # update the hwdetected flags
122     import_resource client_serials "${serial}" hwdetected 1
123    }
124    
125    set_hardware_detect()
126    {
127     local serial="${CLASS_ARGV[0]}"
128    
129     local cmd
130     local netcard_driver
131     local networking
132     local hostname
133     local domain
134     local graphic_driver
135     local monitor_info
136     local monitor_resolution
137     local hwdetected
138    
139     if [[ -z ${serial} ]]
140     then
141     eecho "No serial given"
142     return 1
143     fi
144    
145     run_hardware_detect "${serial}"
146  }  }

Legend:
Removed from v.2495  
changed lines
  Added in v.2508