1 #!/bin/sh -e
2 #
3 # Report the detected HW. Note that this needs to run both inside d-i
4 # and in a regular debian system, as well as behaving robustly if commands
5 # are missing or broken.
6
7 addinfo () {
8 sed "s%^%$1: %"
9 }
10
11 addfile () {
12 if [ -r "$1" ]; then
13 cat "$1" | addinfo "$1"
14 fi
15 }
16
17 uname -a 2>&1 | addinfo "uname -a"
18
19 if type lspci >/dev/null 2>&1; then
20 if [ "$(uname -s)" = Linux ] ; then
21 lspci -knn 2>&1 | addinfo "lspci -knn"
22 else
23 lspci -nn 2>&1 | addinfo "lspci -nn"
24 fi
25 #lspci -vnn 2>&1 | addinfo "lspci -vnn"
26 else
27 addfile /proc/pci
28 addfile /proc/bus/pci/devices
29 fi
30
31 if type usb-list >/dev/null 2>&1; then
32 # only available in udeb
33 usb-list 2>&1 | addinfo usb-list
34 elif [ -r /proc/bus/usb/devices ]; then
35 # usbfs dropped per 2.6.31
36 addfile /proc/bus/usb/devices
37 elif [ -r /sys/debug/usb/devices ]; then
38 # added per 2.6.31 but debugfs may not be mounted
39 addfile /sys/debug/usb/devices
40 elif type usb-devices >/dev/null 2>&1; then
41 # planned (2009/06) to be added in usbutils
42 usb-devices 2>&1 | addinfo usb-devices
43 elif type lsusb >/dev/null 2>&1; then
44 lsusb 2>&1 | addinfo lsusb
45 else
46 echo "No USB information available" | addinfo usb
47 fi
48
49 if type prtconf >/dev/null 2>&1 ; then
50 prtconf 2>&1 | addinfo "prtconf"
51 fi
52
53 # On GNU/Linux
54 if type lsmod > /dev/null 2>&1 ; then
55 lsmod 2>&1 | addinfo "lsmod"
56 fi
57 # On GNU/kFreeBSD
58 if type kldstat > /dev/null 2>&1 ; then
59 kldstat 2>&1 | addinfo "kldstat"
60 fi
61
62 df 2>&1 | addinfo df
63 free 2>&1 | addinfo free
64
65 if type pccardctl >/dev/null 2>&1; then
66 pccardctl status 2>&1 | addinfo "pccardctl status"
67 pccardctl ident 2>&1 | addinfo "pccardctl ident"
68 fi
69
70 if type dmraid >/dev/null 2>&1; then
71 dmraid -s 2>&1 | addinfo "dmraid -s"
72 dmraid -r 2>&1 | addinfo "dmraid -r"
73 if type dmsetup >/dev/null 2>&1; then
74 dmsetup table 2>&1 | addinfo "dmsetup table"
75 fi
76 fi
77
78 for file in cmdline cpuinfo ioports iomem interrupts meminfo \
79 bus/input/devices; do
80 addfile /proc/$file
81 done
82
83 if type dmidecode >/dev/null 2>&1; then
84 dmidecode 2>&1 | addinfo dmidecode
85 fi
86
87 if [ "$DEBIAN_FRONTEND" = gtk ]; then
88 addfile /proc/fb
89 addfile /etc/directfbrc
90 if type dfbinfo; then
91 dfbinfo 2>&1 | addinfo dfbinfo
92 fi
93 fi
阅读(696) | 评论(0) | 转发(0) |