Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2826 - (show annotations) (download)
Wed Aug 2 08:02:44 2017 UTC (6 years, 9 months ago) by niro
File size: 7232 byte(s)
-honor changes of r2819 - fixed iface handling
1 provide hardware
2 require hwdetection
3
4 helper_hardware_netcard_device()
5 {
6 local device
7 local CONFIG
8
9 device="$(get_hwinfo netcard)"
10
11 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/netcard.device"
12 clearconfig
13 addconfig "${device}"
14
15 rvecho "${device}"
16 }
17
18 helper_hardware_netcard_driver()
19 {
20 local driver
21 local CONFIG
22
23 driver="$(get_driver_modules netcard)"
24
25 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/netcard.driver"
26 clearconfig
27 addconfig "${driver}"
28
29 rvecho "${driver}"
30 }
31
32 helper_hardware_wlan_device()
33 {
34 local device
35 local CONFIG
36
37 device="$(get_hwinfo wlan)"
38
39 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/wlan.device"
40 clearconfig
41 addconfig "${device}"
42
43 rvecho "${device}"
44 }
45
46 helper_hardware_wlan_driver()
47 {
48 local driver
49 local CONFIG
50
51 driver="$(get_driver_modules wlan)"
52
53 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/wlan.driver"
54 clearconfig
55 addconfig "${driver}"
56
57 rvecho "${driver}"
58 }
59
60 # hardware_graphic_device()
61 # {
62 # local device
63 # graphic.device
64 # }
65
66 helper_hardware_graphic_driver()
67 {
68 local driver
69 local CONFIG
70
71 driver="$(get_x11_driver_modules)"
72
73 # sane fallback
74 [[ -z ${driver} ]] && driver="vesa"
75
76 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/graphic.driver"
77 clearconfig
78 addconfig "${driver}"
79
80 rvecho "${driver}"
81 }
82
83 helper_hardware_disk_device()
84 {
85 local device
86 local CONFIG
87
88 device="$(get_hwinfo disk)"
89
90 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/disk.device"
91 clearconfig
92 addconfig "${device}"
93
94 rvecho "${device}"
95 }
96
97 helper_hardware_cdrom_device()
98 {
99 local device
100 local CONFIG
101
102 device="$(get_hwinfo cdrom)"
103
104 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/cdrom.device"
105 clearconfig
106 addconfig "${device}"
107
108 rvecho "${device}"
109 }
110
111 helper_hardware_keyboard_device()
112 {
113 local device
114 local CONFIG
115
116 device="$(get_hwinfo keyboard)"
117
118 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/keyboard.device"
119 clearconfig
120 addconfig "${device}"
121
122 rvecho "${device}"
123 }
124
125 # helper_hardware_keyboard_info()
126 # {
127 # keyboard.info
128 # }
129
130 helper_hardware_mouse_device()
131 {
132 local device
133 local CONFIG
134
135 device="$(get_hwinfo mouse)"
136
137 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/mouse.device"
138 clearconfig
139 addconfig "${device}"
140
141 rvecho "${device}"
142 }
143
144 # helper_hardware_mouse_info()
145 # {
146 # mouse.info
147 # }
148
149 helper_hardware_printer_device()
150 {
151 local device
152 local CONFIG
153
154 device="$(get_hwinfo printer)"
155
156 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/printer.device"
157 clearconfig
158 addconfig "${device}"
159
160 rvecho "${device}"
161 }
162
163 helper_hardware_printer_driver()
164 {
165 local driver
166 local CONFIG
167
168 driver="$(get_driver_modules printer)"
169
170 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/printer.driver"
171 clearconfig
172 addconfig "${driver}"
173
174 rvecho "${driver}"
175 }
176
177 # hardware_printer_info()
178 # {
179 # printer.info
180 # }
181
182 helper_hardware_sound_device()
183 {
184 local device
185 local CONFIG
186
187 device="$(get_hwinfo sound)"
188
189 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/sound.device"
190 clearconfig
191 addconfig "${device}"
192
193 rvecho "${device}"
194 }
195
196 helper_hardware_sound_driver()
197 {
198 local driver
199 local CONFIG
200
201 driver="$(get_driver_modules sound)"
202
203 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/sound.driver"
204 clearconfig
205 addconfig "${driver}"
206
207 rvecho "${driver}"
208 }
209
210 # helper_hardware_sound_info()
211 # {
212 # sound.info
213 # }
214
215 helper_hardware_monitor_info()
216 {
217 local info
218 local CONFIG
219
220 info="$(get_hwinfo_monitor)"
221
222 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.hsync"
223 clearconfig
224 addconfig "$(echo ${info} | cut -d';' -f1)"
225
226 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.vsync"
227 clearconfig
228 addconfig "$(echo ${info} | cut -d';' -f2)"
229
230 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/monitor.resolution"
231 clearconfig
232 addconfig "$(echo ${info} | cut -d';' -f3)"
233
234 rvecho "${info}"
235 }
236
237 helper_hardware_arch_info()
238 {
239 local info
240 local CONFIG
241
242 info="$(hwinfo --short --arch)"
243
244 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/arch.info"
245 clearconfig
246 addconfig "${info}"
247
248 rvecho "${info}"
249 }
250
251 helper_hardware_cpu_info()
252 {
253 local info
254 local CONFIG
255
256 info="$(hwinfo --short --cpu)"
257
258 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/cpu.info"
259 clearconfig
260 addconfig "${info}"
261
262 rvecho "${info}"
263 }
264
265 helper_hardware_memory_info()
266 {
267 local info
268 local CONFIG
269
270 info="$(get_hwinfo memory)"
271
272 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/memory.info"
273 clearconfig
274 addconfig "${info}"
275
276 rvecho "${info}"
277 }
278
279 helper_hardware_connected-iface_info()
280 {
281 local CONFIG
282
283 local control_server_ip=$(dns_to_ip $(mcore-controlserver))
284 local iface=$(iface_for_remote_addr ${control_server_ip})
285
286 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/connected-iface.info"
287 clearconfig
288 addconfig "${iface}"
289
290 rvecho "${iface}"
291 }
292
293 helper_hardware_connected-iface_driver()
294 {
295 local driver
296 local CONFIG
297
298 local control_server_ip=$(dns_to_ip $(mcore-controlserver))
299 local iface=$(iface_for_remote_addr ${control_server_ip})
300
301 driver=$(get_driver_modules "netcard --only ${iface}")
302
303 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/hardware/connected-iface.driver"
304 clearconfig
305 addconfig "${driver}"
306
307 rvecho "${driver}"
308 }
309
310 # helper_hardware_framebuffer_info()
311 # {
312 # framebuffer.info
313 # }
314
315 # helper_hardware_bios_info()
316 # {
317 # bios.info -> zotac, virtualbox etc??
318 # }
319
320 # get_hardware_info()
321 # {
322 # local class="$1"
323 #
324 # case "${class}" in
325 # memory|cpu|arch|monitor) helper_hardware_"${class}"_info ;;
326 # esac
327 # }
328 #
329 # get_hardware_driver()
330 # {
331 # local class="$1"
332 #
333 # case "${class}" in
334 # netcard|graphic|sound|printer) helper_hardware_"${class}"_driver ;;
335 # esac
336 # }
337 #
338 # get_hardware_device()
339 # {
340 # local class="$1"
341 #
342 # case "${class}" in
343 # netcard|graphic|sound|printer) helper_hardware_"${class}"_device ;;
344 # disk|cdrom|keyboard|mouse) helper_hardware_"${class}"_device ;;
345 # esac
346 # }
347
348 help_hardware_detect()
349 {
350 mecho "get hardware.detect [action] [class]"
351 mecho " Prints information about the systems hardware"
352 mecho " Available classes:"
353 mecho " memory, cpu, arch, monitor, netcard, wlan, graphic, sound,"
354 mecho " printer, disk, cdrom, keyboard, mouse, connected-iface"
355 mecho " Available actions:"
356 mecho " info - general information about a hwclass"
357 mecho " driver - needed drivers of selected class if available"
358 mecho " device - prints the device of selected class if available"
359 }
360
361 get_hardware_detect()
362 {
363 local action="${CLASS_ARGV[0]}"
364 local class="${CLASS_ARGV[1]}"
365
366 # sanity check
367 case "${action}" in
368 info|driver|device) ;;
369 *) help_hardware_detect && return 1 ;;
370 esac
371
372 case "${class}" in
373 memory) helper_hardware_"${class}"_"${action}" ;;
374 cpu) helper_hardware_"${class}"_"${action}" ;;
375 arch) helper_hardware_"${class}"_"${action}" ;;
376 monitor) helper_hardware_"${class}"_"${action}" ;;
377 netcard) helper_hardware_"${class}"_"${action}" ;;
378 wlan) helper_hardware_"${class}"_"${action}" ;;
379 graphic) helper_hardware_"${class}"_"${action}" ;;
380 sound) helper_hardware_"${class}"_"${action}" ;;
381 printer) helper_hardware_"${class}"_"${action}" ;;
382 disk) helper_hardware_"${class}"_"${action}" ;;
383 cdrom) helper_hardware_"${class}"_"${action}" ;;
384 keyboard) helper_hardware_"${class}"_"${action}" ;;
385 mouse) helper_hardware_"${class}"_"${action}" ;;
386 connected-iface) helper_hardware_"${class}"_"${action}" ;;
387 *) help_hardware_detect && return 1 ;;
388 esac
389 }