Contents of /mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in
Parent Directory | Revision Log
Revision 2496 -
(show annotations)
(download)
Thu Sep 10 13:53:32 2015 UTC (8 years, 7 months ago) by niro
File size: 2257 byte(s)
Thu Sep 10 13:53:32 2015 UTC (8 years, 7 months ago) by niro
File size: 2257 byte(s)
-respect returned NULL setting from database too
1 | # $Id$ |
2 | |
3 | require hwdetection |
4 | require mysql |
5 | |
6 | set_hardware_detect() |
7 | { |
8 | local serial="${CLASS_ARGV[0]}" |
9 | |
10 | local cmd |
11 | local netcard_driver |
12 | local networking |
13 | local hostname |
14 | local domain |
15 | local graphic_driver |
16 | local monitor_info |
17 | local monitor_resolution |
18 | |
19 | nsslsay_queue_init |
20 | nsslsay_queue_add "nocolors" |
21 | nsslsay_queue_add "get hardware.detect driver netcard" |
22 | netcard_driver=$(control_client "${serial}" run-queue) |
23 | if [[ -n ${netcard_driver} ]] |
24 | then |
25 | decho "netcard_driver='${netcard_driver}'" |
26 | import_resource cfg_network "${serial}" module "${netcard_driver}" |
27 | else |
28 | decho "no netcard_driver found" |
29 | fi |
30 | networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
31 | if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] |
32 | then |
33 | # set network to dhcp |
34 | decho "networking='dhcp'" |
35 | import_resource cfg_network "${serial}" networking "dhcp" |
36 | fi |
37 | hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
38 | if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] |
39 | then |
40 | # set hostname to MCORE_DEFAULT_HOSTNAME |
41 | decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
42 | import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
43 | fi |
44 | domain=$(mysqldo "select domain from cfg_network where serial=${serial};") |
45 | if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] |
46 | then |
47 | # set domain to MCORE_DEFAULT_DOMAIN |
48 | decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
49 | import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}" |
50 | fi |
51 | |
52 | nsslsay_queue_init |
53 | nsslsay_queue_add "nocolors" |
54 | nsslsay_queue_add "get hardware.detect driver graphic" |
55 | graphic_driver=$(control_client "${serial}" run-queue) |
56 | if [[ -n ${graphic_driver} ]] |
57 | then |
58 | decho "graphic_driver='${graphic_driver}'" |
59 | import_resource cfg_graphic "${serial}" module "${graphic_driver}" |
60 | else |
61 | decho "no graphic_driver found" |
62 | fi |
63 | |
64 | nsslsay_queue_init |
65 | nsslsay_queue_add "nocolors" |
66 | nsslsay_queue_add "get hardware.detect info monitor" |
67 | monitor_info=$(control_client "${serial}" run-queue) |
68 | monitor_resolution="${monitor_info##*;}" |
69 | if [[ -n ${monitor_resolution} ]] |
70 | then |
71 | decho "monitor_resolution='${monitor_resolution}'" |
72 | import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}" |
73 | else |
74 | decho "no monitor_resolution found" |
75 | fi |
76 | } |