-
Notifications
You must be signed in to change notification settings - Fork 71
/
getsysinfo
executable file
·91 lines (75 loc) · 1.66 KB
/
getsysinfo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#! /bin/sh
if [ "$1" ] ; then
cat <<EOF
Usage: getsysinfo
Collect some system data that are useful for debugging
hardware detection bugs.
EOF
exit 0
fi
# collect some system data
dir=`mktemp -d /tmp/getsysinfo.XXXXXXXXXX`
[ -d "$dir" ] || exit 1
host=`hostname`
[ "$host" ] || host=xxx
mkdir -p "$dir/$host"
for i in \
/proc/asound \
/proc/bus/input \
/proc/cpuinfo \
/proc/device-tree \
/proc/devices \
/proc/dma \
/proc/driver/nvram \
/proc/fb \
/proc/filesystems \
/proc/iSeries \
/proc/ide \
/proc/interrupts \
/proc/iomem \
/proc/ioports \
/proc/meminfo \
/proc/modules \
/proc/net/dev \
/proc/partitions \
/proc/scsi \
/proc/sys/dev/cdrom/info \
/proc/sys/dev/parport \
/proc/tty \
/proc/version \
/sys \
/var/log/boot.msg \
/var/lib/hardware/udi
do
if [ -e "$i" ] ; then
echo "$i"
cp -x -a --parents "$i" "$dir/$host" 2>/dev/null
chmod -R u+w,a+r,a+X "$dir/$host"
for i in `( cd "$dir/$host" ; find proc -type f -size 0 )` ; do
cat "/$i" >"$dir/$host/$i"
done
fi
done
echo /proc/mounts
perl -nl -e 'print unless (split)[0] =~ /none|automount|:/' /proc/mounts >"$dir/$host/proc/mounts"
mkdir -p "$dir/$host/var/log"
echo "
------ dmesg start ------
" >>"$dir/$host/var/log/boot.msg"
dmesg >>"$dir/$host/var/log/boot.msg"
if [ -x /usr/bin/lshal ] ; then
echo lshal
lshal >$dir/$host/lshal.txt 2>/dev/null
fi
file="$host.tar.gz"
tar -C "$dir" -zcf "$dir/$file" "$host"
rm -f "/tmp/$file"
if [ -e "/tmp/$file" ] ; then
echo "Warning: /tmp/$file exists, no info written"\!
rm -rf "$dir"
exit 1
fi
ln -nf "$dir/$file" "/tmp/$file"
rm -rf "$dir"
echo "
System data written to: /tmp/$file"