1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
|
provide hardware |
4 |
require hwdetection |
require hwdetection |
5 |
require mysql |
require mysql |
6 |
|
|
7 |
set_hardware_detect() |
run_hardware_detect() |
8 |
{ |
{ |
9 |
local serial="${CLASS_ARGV[0]}" |
local serial="$1" |
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 |
|
if [[ -z ${serial} ]] |
22 |
|
then |
23 |
|
decho "No serial given" |
24 |
|
return 1 |
25 |
|
fi |
26 |
|
|
27 |
|
# first check if hardware detect was already done |
28 |
|
hwdetected=$(mysqldo "select hwdetected from client_serials where serial=${serial};") |
29 |
|
if [[ ${hwdetected} = 1 ]] |
30 |
|
then |
31 |
|
decho "hardware detection already run, aborting" |
32 |
|
return 0 |
33 |
|
else |
34 |
|
decho "running hardware detection" |
35 |
|
fi |
36 |
|
|
37 |
nsslsay_queue_init |
nsslsay_queue_init |
38 |
nsslsay_queue_add "nocolors" |
nsslsay_queue_add "nocolors" |
45 |
else |
else |
46 |
decho "no netcard_driver found" |
decho "no netcard_driver found" |
47 |
fi |
fi |
48 |
if [[ -z $(mysqldo "select networking from cfg_network where serial=${serial};") ]] |
networking=$(mysqldo "select networking from cfg_network where serial=${serial};") |
49 |
|
if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] |
50 |
then |
then |
51 |
# set network to dhcp |
# set network to dhcp |
52 |
decho "networking='dhcp'" |
decho "networking='dhcp'" |
53 |
import_resource cfg_network "${serial}" networking "dhcp" |
import_resource cfg_network "${serial}" networking "dhcp" |
54 |
fi |
fi |
55 |
if [[ -z $(mysqldo "select hostname from cfg_network where serial=${serial};") ]] |
hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") |
56 |
|
if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] |
57 |
then |
then |
58 |
# set hostname to MCORE_DEFAULT_HOSTNAME |
# set hostname to MCORE_DEFAULT_HOSTNAME |
59 |
decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" |
60 |
import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" |
61 |
fi |
fi |
62 |
if [[ -z $(mysqldo "select domain from cfg_network where serial=${serial};") ]] |
domain=$(mysqldo "select domain from cfg_network where serial=${serial};") |
63 |
|
if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] |
64 |
then |
then |
65 |
# set domain to MCORE_DEFAULT_DOMAIN |
# set domain to MCORE_DEFAULT_DOMAIN |
66 |
decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
decho "hostname='${MCORE_DEFAULT_DOMAIN}'" |
91 |
else |
else |
92 |
decho "no monitor_resolution found" |
decho "no monitor_resolution found" |
93 |
fi |
fi |
94 |
|
|
95 |
|
# update the hwdetected flags |
96 |
|
import_resource client_serials "${serial}" hwdetected 1 |
97 |
|
} |
98 |
|
|
99 |
|
set_hardware_detect() |
100 |
|
{ |
101 |
|
local serial="${CLASS_ARGV[0]}" |
102 |
|
|
103 |
|
local cmd |
104 |
|
local netcard_driver |
105 |
|
local networking |
106 |
|
local hostname |
107 |
|
local domain |
108 |
|
local graphic_driver |
109 |
|
local monitor_info |
110 |
|
local monitor_resolution |
111 |
|
local hwdetected |
112 |
|
|
113 |
|
if [[ -z ${serial} ]] |
114 |
|
then |
115 |
|
eecho "No serial given" |
116 |
|
return 1 |
117 |
|
fi |
118 |
|
|
119 |
|
run_hardware_detect "${serial}" |
120 |
} |
} |