Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2497 - (hide annotations) (download)
Thu Sep 10 14:08:40 2015 UTC (8 years, 8 months ago) by niro
File size: 2619 byte(s)
-run hardware detection on register_client if hardware was provided and not already run
1 niro 2487 # $Id$
2    
3 niro 2497 provide hardware
4 niro 2487 require hwdetection
5     require mysql
6    
7     set_hardware_detect()
8     {
9     local serial="${CLASS_ARGV[0]}"
10    
11     local cmd
12     local netcard_driver
13 niro 2496 local networking
14     local hostname
15     local domain
16 niro 2487 local graphic_driver
17     local monitor_info
18     local monitor_resolution
19 niro 2497 local hwdetected
20 niro 2487
21 niro 2497 # first check if hardware detect was already done
22     hwdetected=$(mysqldo "select hwdetected from client_serials where serial=${serial};")
23     if [[ ${hwdetected} = 1 ]]
24     then
25     decho "hardware detection already run, aborting"
26     return 0
27     fi
28    
29 niro 2487 nsslsay_queue_init
30     nsslsay_queue_add "nocolors"
31     nsslsay_queue_add "get hardware.detect driver netcard"
32     netcard_driver=$(control_client "${serial}" run-queue)
33     if [[ -n ${netcard_driver} ]]
34     then
35 niro 2495 decho "netcard_driver='${netcard_driver}'"
36     import_resource cfg_network "${serial}" module "${netcard_driver}"
37 niro 2487 else
38     decho "no netcard_driver found"
39     fi
40 niro 2496 networking=$(mysqldo "select networking from cfg_network where serial=${serial};")
41     if [[ -z ${networking} ]] || [[ ${networking} = NULL ]]
42 niro 2488 then
43     # set network to dhcp
44 niro 2493 decho "networking='dhcp'"
45 niro 2488 import_resource cfg_network "${serial}" networking "dhcp"
46     fi
47 niro 2496 hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};")
48     if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]]
49 niro 2488 then
50     # set hostname to MCORE_DEFAULT_HOSTNAME
51 niro 2493 decho "hostname='${MCORE_DEFAULT_HOSTNAME}'"
52 niro 2488 import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}"
53     fi
54 niro 2496 domain=$(mysqldo "select domain from cfg_network where serial=${serial};")
55     if [[ -z ${domain} ]] || [[ ${domain} = NULL ]]
56 niro 2491 then
57     # set domain to MCORE_DEFAULT_DOMAIN
58 niro 2493 decho "hostname='${MCORE_DEFAULT_DOMAIN}'"
59 niro 2491 import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}"
60     fi
61 niro 2487
62     nsslsay_queue_init
63     nsslsay_queue_add "nocolors"
64     nsslsay_queue_add "get hardware.detect driver graphic"
65     graphic_driver=$(control_client "${serial}" run-queue)
66     if [[ -n ${graphic_driver} ]]
67     then
68     decho "graphic_driver='${graphic_driver}'"
69     import_resource cfg_graphic "${serial}" module "${graphic_driver}"
70     else
71     decho "no graphic_driver found"
72     fi
73    
74     nsslsay_queue_init
75     nsslsay_queue_add "nocolors"
76 niro 2493 nsslsay_queue_add "get hardware.detect info monitor"
77 niro 2487 monitor_info=$(control_client "${serial}" run-queue)
78     monitor_resolution="${monitor_info##*;}"
79     if [[ -n ${monitor_resolution} ]]
80     then
81     decho "monitor_resolution='${monitor_resolution}'"
82     import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}"
83     else
84     decho "no monitor_resolution found"
85     fi
86 niro 2497
87     # update the hwdetected flags
88     import_resource client_serial "${serial}" hwdetected 1
89 niro 2487 }