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 |
16 |
local graphic_driver |
local graphic_driver |
17 |
local monitor_info |
local monitor_info |
18 |
local monitor_resolution |
local monitor_resolution |
19 |
|
local keymap |
20 |
|
local hwdetected |
21 |
|
local i |
22 |
|
|
23 |
|
if [[ -z ${serial} ]] |
24 |
|
then |
25 |
|
decho "No serial given" |
26 |
|
return 1 |
27 |
|
fi |
28 |
|
|
29 |
|
# first check if hardware detect was already done |
30 |
|
hwdetected=$(mysqldo "select hwdetected from client_serials where serial=${serial};") |
31 |
|
if [[ ${hwdetected} = 1 ]] |
32 |
|
then |
33 |
|
decho "hardware detection already run, aborting" |
34 |
|
return 0 |
35 |
|
else |
36 |
|
decho "running hardware detection" |
37 |
|
fi |
38 |
|
|
39 |
nsslsay_queue_init |
nsslsay_queue_init |
40 |
nsslsay_queue_add "nocolors" |
nsslsay_queue_add "nocolors" |
93 |
else |
else |
94 |
decho "no monitor_resolution found" |
decho "no monitor_resolution found" |
95 |
fi |
fi |
96 |
|
|
97 |
|
keymap=$(mysqldo "select keymap from cfg_input where serial=${serial};") |
98 |
|
if [[ -z ${keymap} ]] || [[ ${keymap} = NULL ]] |
99 |
|
then |
100 |
|
# set keymap to MCORE_DEFAULT_KEYMAP |
101 |
|
decho "keymap='${MCORE_DEFAULT_KEYMAP}'" |
102 |
|
import_resource cfg_input "${serial}" keymap "${MCORE_DEFAULT_KEYMAP}" |
103 |
|
fi |
104 |
|
|
105 |
|
# now setup some empty database entries if the does not exist |
106 |
|
for i in user root vnc |
107 |
|
do |
108 |
|
if [[ -z $(mysqldo "select ${i} from client_auth where serial=${serial};") ]] |
109 |
|
then |
110 |
|
decho "set empty ${i} pass" |
111 |
|
import_resource client_auth "${serial}" "${i}" "" |
112 |
|
fi |
113 |
|
done |
114 |
|
|
115 |
|
# update the hwdetected flags |
116 |
|
import_resource client_serials "${serial}" hwdetected 1 |
117 |
|
} |
118 |
|
|
119 |
|
set_hardware_detect() |
120 |
|
{ |
121 |
|
local serial="${CLASS_ARGV[0]}" |
122 |
|
|
123 |
|
local cmd |
124 |
|
local netcard_driver |
125 |
|
local networking |
126 |
|
local hostname |
127 |
|
local domain |
128 |
|
local graphic_driver |
129 |
|
local monitor_info |
130 |
|
local monitor_resolution |
131 |
|
local hwdetected |
132 |
|
|
133 |
|
if [[ -z ${serial} ]] |
134 |
|
then |
135 |
|
eecho "No serial given" |
136 |
|
return 1 |
137 |
|
fi |
138 |
|
|
139 |
|
run_hardware_detect "${serial}" |
140 |
} |
} |