5 |
# get_hwinfo $hw_item |
# get_hwinfo $hw_item |
6 |
get_hwinfo() |
get_hwinfo() |
7 |
{ |
{ |
8 |
|
local enable_desc="0" |
9 |
|
|
10 |
|
if [[ $1 = --with-description ]] || [[ $1 = -d ]] |
11 |
|
then |
12 |
|
enable_desc=1 |
13 |
|
shift |
14 |
|
fi |
15 |
|
|
16 |
local item="$1" |
local item="$1" |
17 |
local all |
local all |
18 |
local i |
local i |
19 |
|
|
20 |
|
# handle special items |
21 |
|
case ${item} in |
22 |
|
memory) get_hwinfo_memory; return ;; |
23 |
|
smp) get_hwinfo_smp; return ;; |
24 |
|
esac |
25 |
|
|
26 |
all=$(hwinfo --short --"${item}") |
all=$(hwinfo --short --"${item}") |
27 |
|
|
28 |
declare -i i=0 |
declare -i i=0 |
32 |
(( i++ )) |
(( i++ )) |
33 |
[ ${i} -eq 1 ] && continue |
[ ${i} -eq 1 ] && continue |
34 |
|
|
35 |
echo "${device};${description}" |
if [[ ${enable_desc} = 1 ]] |
36 |
|
then |
37 |
|
echo "${device};${description}" |
38 |
|
else |
39 |
|
echo "${device}" |
40 |
|
fi |
41 |
done <<< "${all}" |
done <<< "${all}" |
42 |
} |
} |
43 |
|
|
44 |
|
|
45 |
|
# special memory case |
46 |
|
get_hwinfo_memory() |
47 |
|
{ |
48 |
|
local memory=$(hwinfo --memory | grep "Memory Size" | cut -d: -f2 | sed "s:\ ::") |
49 |
|
echo "${memory}" |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
# special smp case |
54 |
|
get_hwinfo_smp() |
55 |
|
{ |
56 |
|
local smp=$(hwinfo --smp | grep "SMP support:" | cut -d: -f2 | sed "s:\ ::") |
57 |
|
echo "${smp}" |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
# get_driver_modules $hw_item |
# get_driver_modules $hw_item |
62 |
get_driver_modules() |
get_driver_modules() |
63 |
{ |
{ |
182 |
# done |
# done |
183 |
|
|
184 |
#create_initrd /root/TEST/initrd |
#create_initrd /root/TEST/initrd |
185 |
get_driver_modules cdrom |
#get_driver_modules cdrom |
186 |
#get_driver_modules disk |
#get_driver_modules disk |
187 |
#get_driver_modules scsi |
#get_driver_modules scsi |
188 |
#get_driver_modules all |
#get_driver_modules all |
189 |
|
|
190 |
# network |
# network |
191 |
#get_hwinfo netcard |
#get_hwinfo --with-description netcard |
192 |
#get_driver_modules netcard |
#get_driver_modules netcard |
193 |
|
|
194 |
#get_hwinfo disk |
#get_hwinfo disk |