Annotation of /mcore-src/trunk/mcore-tools/src/modules/hwinfo/hardware.control.class.in
Parent Directory | Revision Log
Revision 2498 -
(hide annotations)
(download)
Thu Sep 10 14:11:50 2015 UTC (8 years, 8 months ago) by niro
File size: 2662 byte(s)
Thu Sep 10 14:11:50 2015 UTC (8 years, 8 months ago) by niro
File size: 2662 byte(s)
-more debug messages
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 | niro | 2498 | else |
28 | decho "running hardware detection" | ||
29 | niro | 2497 | fi |
30 | |||
31 | niro | 2487 | nsslsay_queue_init |
32 | nsslsay_queue_add "nocolors" | ||
33 | nsslsay_queue_add "get hardware.detect driver netcard" | ||
34 | netcard_driver=$(control_client "${serial}" run-queue) | ||
35 | if [[ -n ${netcard_driver} ]] | ||
36 | then | ||
37 | niro | 2495 | decho "netcard_driver='${netcard_driver}'" |
38 | import_resource cfg_network "${serial}" module "${netcard_driver}" | ||
39 | niro | 2487 | else |
40 | decho "no netcard_driver found" | ||
41 | fi | ||
42 | niro | 2496 | networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
43 | if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] | ||
44 | niro | 2488 | then |
45 | # set network to dhcp | ||
46 | niro | 2493 | decho "networking='dhcp'" |
47 | niro | 2488 | import_resource cfg_network "${serial}" networking "dhcp" |
48 | fi | ||
49 | niro | 2496 | hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
50 | if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] | ||
51 | niro | 2488 | then |
52 | # set hostname to MCORE_DEFAULT_HOSTNAME | ||
53 | niro | 2493 | decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
54 | niro | 2488 | import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
55 | fi | ||
56 | niro | 2496 | domain=$(mysqldo "select domain from cfg_network where serial=${serial};") |
57 | if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] | ||
58 | niro | 2491 | then |
59 | # set domain to MCORE_DEFAULT_DOMAIN | ||
60 | niro | 2493 | decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
61 | niro | 2491 | import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}" |
62 | fi | ||
63 | niro | 2487 | |
64 | nsslsay_queue_init | ||
65 | nsslsay_queue_add "nocolors" | ||
66 | nsslsay_queue_add "get hardware.detect driver graphic" | ||
67 | graphic_driver=$(control_client "${serial}" run-queue) | ||
68 | if [[ -n ${graphic_driver} ]] | ||
69 | then | ||
70 | decho "graphic_driver='${graphic_driver}'" | ||
71 | import_resource cfg_graphic "${serial}" module "${graphic_driver}" | ||
72 | else | ||
73 | decho "no graphic_driver found" | ||
74 | fi | ||
75 | |||
76 | nsslsay_queue_init | ||
77 | nsslsay_queue_add "nocolors" | ||
78 | niro | 2493 | nsslsay_queue_add "get hardware.detect info monitor" |
79 | niro | 2487 | monitor_info=$(control_client "${serial}" run-queue) |
80 | monitor_resolution="${monitor_info##*;}" | ||
81 | if [[ -n ${monitor_resolution} ]] | ||
82 | then | ||
83 | decho "monitor_resolution='${monitor_resolution}'" | ||
84 | import_resource cfg_graphic "${serial}" resolution "${monitor_resolution}" | ||
85 | else | ||
86 | decho "no monitor_resolution found" | ||
87 | fi | ||
88 | niro | 2497 | |
89 | # update the hwdetected flags | ||
90 | import_resource client_serial "${serial}" hwdetected 1 | ||
91 | niro | 2487 | } |