1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
|
provide hardware |
4 |
require hwdetection |
require hwdetection |
5 |
require mysql |
require mysql |
6 |
|
|
10 |
|
|
11 |
local cmd |
local cmd |
12 |
local netcard_driver |
local netcard_driver |
13 |
|
local networking |
14 |
|
local hostname |
15 |
|
local domain |
16 |
local graphic_driver |
local graphic_driver |
17 |
local monitor_info |
local monitor_info |
18 |
local monitor_resolution |
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 |
nsslsay_queue_init |
32 |
nsslsay_queue_add "nocolors" |
nsslsay_queue_add "nocolors" |
34 |
netcard_driver=$(control_client "${serial}" run-queue) |
netcard_driver=$(control_client "${serial}" run-queue) |
35 |
if [[ -n ${netcard_driver} ]] |
if [[ -n ${netcard_driver} ]] |
36 |
then |
then |
37 |
decho "netcard_driver='${netcard_driver}'" |
decho "netcard_driver='${netcard_driver}'" |
38 |
import_resource cfg_network "${serial}" module "${netcard_driver}" |
import_resource cfg_network "${serial}" module "${netcard_driver}" |
39 |
else |
else |
40 |
decho "no netcard_driver found" |
decho "no netcard_driver found" |
41 |
fi |
fi |
42 |
if [[ -z $(mysqldo "select networking from cfg_network where serial=${serial};") ]] |
networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
43 |
|
if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] |
44 |
then |
then |
45 |
# set network to dhcp |
# set network to dhcp |
46 |
|
decho "networking='dhcp'" |
47 |
import_resource cfg_network "${serial}" networking "dhcp" |
import_resource cfg_network "${serial}" networking "dhcp" |
48 |
fi |
fi |
49 |
if [[ -z $(mysqldo "select hostname from cfg_network where serial=${serial};") ]] |
hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
50 |
|
if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] |
51 |
then |
then |
52 |
# set hostname to MCORE_DEFAULT_HOSTNAME |
# set hostname to MCORE_DEFAULT_HOSTNAME |
53 |
|
decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
54 |
import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
55 |
fi |
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 |
nsslsay_queue_init |
65 |
nsslsay_queue_add "nocolors" |
nsslsay_queue_add "nocolors" |
75 |
|
|
76 |
nsslsay_queue_init |
nsslsay_queue_init |
77 |
nsslsay_queue_add "nocolors" |
nsslsay_queue_add "nocolors" |
78 |
nsslsay_queue_add "get hardware.detect info minitor" |
nsslsay_queue_add "get hardware.detect info monitor" |
79 |
monitor_info=$(control_client "${serial}" run-queue) |
monitor_info=$(control_client "${serial}" run-queue) |
80 |
monitor_resolution="${monitor_info##*;}" |
monitor_resolution="${monitor_info##*;}" |
81 |
if [[ -n ${monitor_resolution} ]] |
if [[ -n ${monitor_resolution} ]] |
85 |
else |
else |
86 |
decho "no monitor_resolution found" |
decho "no monitor_resolution found" |
87 |
fi |
fi |
88 |
|
|
89 |
|
# update the hwdetected flags |
90 |
|
import_resource client_serial "${serial}" hwdetected 1 |
91 |
} |
} |