]>
Commit | Line | Data |
---|---|---|
a6316ce4 MT |
1 | #! /bin/sh |
2 | ||
3 | if [ "$1" ] ; then | |
4 | cat <<EOF | |
5 | Usage: getsysinfo | |
6 | Collect some system data that are useful for debugging | |
7 | hardware detection bugs. | |
8 | EOF | |
9 | exit 0 | |
10 | fi | |
11 | ||
12 | # collect some system data | |
13 | ||
14 | dir=`mktemp -d /tmp/getsysinfo.XXXXXXXXXX` | |
15 | ||
16 | [ -d "$dir" ] || exit 1 | |
17 | ||
18 | host=`hostname` | |
19 | [ "$host" ] || host=xxx | |
20 | ||
21 | mkdir -p "$dir/$host" | |
22 | ||
23 | for i in \ | |
24 | /proc/bus/input \ | |
25 | /proc/cpuinfo \ | |
26 | /proc/device-tree \ | |
27 | /proc/devices \ | |
28 | /proc/dma \ | |
29 | /proc/driver/nvram \ | |
30 | /proc/fb \ | |
31 | /proc/iSeries \ | |
32 | /proc/ide \ | |
33 | /proc/interrupts \ | |
34 | /proc/iomem \ | |
35 | /proc/ioports \ | |
36 | /proc/meminfo \ | |
37 | /proc/modules \ | |
38 | /proc/net/dev \ | |
39 | /proc/partitions \ | |
40 | /proc/scsi \ | |
41 | /proc/sys/dev/cdrom/info \ | |
42 | /proc/sys/dev/parport \ | |
43 | /proc/tty \ | |
44 | /proc/version \ | |
45 | /sys \ | |
46 | /var/log/boot.msg | |
47 | do | |
48 | if [ -e "$i" ] ; then | |
49 | echo "$i" | |
50 | cp -a --parents "$i" "$dir/$host" 2>/dev/null | |
51 | chmod -R u+w,a+r,a+X "$dir/$host" | |
52 | fi | |
53 | done | |
54 | ||
55 | echo /proc/mounts | |
56 | cp --parents /proc/mounts "$dir/$host" | |
57 | ||
58 | echo -e "\n------ dmesg start ------\n" >>"$dir/$host/var/log/boot.msg" | |
59 | dmesg >>"$dir/$host/var/log/boot.msg" | |
60 | ||
61 | file="$host.tar.gz" | |
62 | tar -C "$dir" -zcf "$dir/$file" "$host" | |
63 | ||
64 | rm -f "/tmp/$file" | |
65 | ||
66 | if [ -e "/tmp/$file" ] ; then | |
67 | echo "Warning: /tmp/$file exists, no info written"\! | |
68 | rm -rf "$dir" | |
69 | exit 1 | |
70 | fi | |
71 | ||
72 | ln -nf "$dir/$file" "/tmp/$file" | |
73 | ||
74 | rm -rf "$dir" | |
75 | ||
76 | echo -e "\nSystem data written to: /tmp/$file" | |
77 |