Contents of /mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in
Parent Directory | Revision Log
Revision 2614 -
(show annotations)
(download)
Thu Sep 24 10:48:55 2015 UTC (8 years, 7 months ago) by niro
File size: 3886 byte(s)
Thu Sep 24 10:48:55 2015 UTC (8 years, 7 months ago) by niro
File size: 3886 byte(s)
-get necard driver from actual used netcard, not from all detected card
1 | # $Id$ |
2 | |
3 | provide hardware |
4 | require hwdetection |
5 | require mysql |
6 | |
7 | run_hardware_detect() |
8 | { |
9 | local serial="$1" |
10 | |
11 | local cmd |
12 | local netcard_driver |
13 | local networking |
14 | local hostname |
15 | local domain |
16 | local graphic_driver |
17 | local monitor_info |
18 | 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 |
41 | nsslsay_queue_add "nocolors" |
42 | #nsslsay_queue_add "get hardware.detect driver netcard" |
43 | nsslsay_queue_add "get hardware.detect driver connected-iface" |
44 | netcard_driver=$(control_client "${serial}" run-queue) |
45 | if [[ -n ${netcard_driver} ]] |
46 | then |
47 | decho "netcard_driver='${netcard_driver}'" |
48 | import_resource cfg_network "${serial}" module "${netcard_driver}" |
49 | else |
50 | decho "no netcard_driver found" |
51 | fi |
52 | networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
53 | if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] |
54 | then |
55 | # set network to dhcp |
56 | decho "networking='dhcp'" |
57 | import_resource cfg_network "${serial}" networking "dhcp" |
58 | fi |
59 | hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
60 | if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] |
61 | then |
62 | # set hostname to MCORE_DEFAULT_HOSTNAME |
63 | decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
64 | import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
65 | fi |
66 | domain=$(mysqldo "select domain from cfg_network where serial=${serial};") |
67 | if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] |
68 | then |
69 | # set domain to MCORE_DEFAULT_DOMAIN |
70 | decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
71 | import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}" |
72 | fi |
73 | |
74 | nsslsay_queue_init |
75 | nsslsay_queue_add "nocolors" |
76 | nsslsay_queue_add "get hardware.detect driver graphic" |
77 | graphic_driver=$(control_client "${serial}" run-queue) |
78 | if [[ -n ${graphic_driver} ]] |
79 | then |
80 | decho "graphic_driver='${graphic_driver}'" |
81 | import_resource cfg_graphic "${serial}" module "${graphic_driver}" |
82 | else |
83 | decho "no graphic_driver found" |
84 | fi |
85 | |
86 | nsslsay_queue_init |
87 | nsslsay_queue_add "nocolors" |
88 | nsslsay_queue_add "get hardware.detect info monitor" |
89 | monitor_info=$(control_client "${serial}" run-queue) |
90 | monitor_resolution="${monitor_info##*;}" |
91 | if [[ -n ${monitor_resolution} ]] |
92 | then |
93 | decho "monitor_resolution='${monitor_resolution}'" |
94 | import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}" |
95 | else |
96 | decho "no monitor_resolution found" |
97 | fi |
98 | |
99 | keymap=$(mysqldo "select keymap from cfg_input where serial=${serial};") |
100 | if [[ -z ${keymap} ]] || [[ ${keymap} = NULL ]] |
101 | then |
102 | # set keymap to MCORE_DEFAULT_KEYMAP |
103 | decho "keymap='${MCORE_DEFAULT_KEYMAP}'" |
104 | import_resource cfg_input "${serial}" keymap "${MCORE_DEFAULT_KEYMAP}" |
105 | fi |
106 | |
107 | # now setup some empty database entries if the does not exist |
108 | for i in user root vnc |
109 | do |
110 | auth=$(mysqldo "select ${i} from client_auth where serial=${serial};") |
111 | if [[ -z ${auth} ]] || [[ ${auth} = NULL ]] |
112 | then |
113 | decho "set empty ${i} pass" |
114 | import_resource client_auth "${serial}" "${i}" "" |
115 | fi |
116 | done |
117 | |
118 | # create an empty screensaver entry |
119 | decho "set empty screensaver" |
120 | import_resource cfg_screensaver "${serial}" "screensaver" "" |
121 | |
122 | # update the hwdetected flags |
123 | import_resource client_serials "${serial}" hwdetected 1 |
124 | } |
125 | |
126 | set_hardware_detect() |
127 | { |
128 | local serial="${CLASS_ARGV[0]}" |
129 | |
130 | local cmd |
131 | local netcard_driver |
132 | local networking |
133 | local hostname |
134 | local domain |
135 | local graphic_driver |
136 | local monitor_info |
137 | local monitor_resolution |
138 | local hwdetected |
139 | |
140 | if [[ -z ${serial} ]] |
141 | then |
142 | eecho "No serial given" |
143 | return 1 |
144 | fi |
145 | |
146 | run_hardware_detect "${serial}" |
147 | } |