Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2498 - (show annotations) (download)
Thu Sep 10 14:11:50 2015 UTC (8 years, 8 months ago) by niro
File size: 2662 byte(s)
-more debug messages
1 # $Id$
2
3 provide hardware
4 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 local networking
14 local hostname
15 local domain
16 local graphic_driver
17 local monitor_info
18 local monitor_resolution
19 local hwdetected
20
21 # 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 else
28 decho "running hardware detection"
29 fi
30
31 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 decho "netcard_driver='${netcard_driver}'"
38 import_resource cfg_network "${serial}" module "${netcard_driver}"
39 else
40 decho "no netcard_driver found"
41 fi
42 networking=$(mysqldo "select networking from cfg_network where serial=${serial};")
43 if [[ -z ${networking} ]] || [[ ${networking} = NULL ]]
44 then
45 # set network to dhcp
46 decho "networking='dhcp'"
47 import_resource cfg_network "${serial}" networking "dhcp"
48 fi
49 hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};")
50 if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]]
51 then
52 # set hostname to MCORE_DEFAULT_HOSTNAME
53 decho "hostname='${MCORE_DEFAULT_HOSTNAME}'"
54 import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}"
55 fi
56 domain=$(mysqldo "select domain from cfg_network where serial=${serial};")
57 if [[ -z ${domain} ]] || [[ ${domain} = NULL ]]
58 then
59 # set domain to MCORE_DEFAULT_DOMAIN
60 decho "hostname='${MCORE_DEFAULT_DOMAIN}'"
61 import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}"
62 fi
63
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 nsslsay_queue_add "get hardware.detect info monitor"
79 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
89 # update the hwdetected flags
90 import_resource client_serial "${serial}" hwdetected 1
91 }