home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / sbin / getsysinfo < prev    next >
Text File  |  2010-05-09  |  2KB  |  89 lines

  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/asound \
  25.   /proc/bus/input \
  26.   /proc/cpuinfo \
  27.   /proc/device-tree \
  28.   /proc/devices \
  29.   /proc/dma \
  30.   /proc/driver/nvram \
  31.   /proc/fb \
  32.   /proc/filesystems \
  33.   /proc/iSeries \
  34.   /proc/ide \
  35.   /proc/interrupts \
  36.   /proc/iomem \
  37.   /proc/ioports \
  38.   /proc/meminfo \
  39.   /proc/modules \
  40.   /proc/net/dev \
  41.   /proc/partitions \
  42.   /proc/scsi \
  43.   /proc/sys/dev/cdrom/info \
  44.   /proc/sys/dev/parport \
  45.   /proc/tty \
  46.   /proc/version \
  47.   /sys \
  48.   /var/log/boot.msg \
  49.   /var/lib/hardware/udi
  50. do
  51.   if [ -e "$i" ] ; then
  52.     echo "$i"
  53.     cp -a --parents "$i" "$dir/$host" 2>/dev/null
  54.     chmod -R u+w,a+r,a+X "$dir/$host"
  55.     for i in `( cd "$dir/$host" ; find proc -type f -size 0 )` ; do
  56.       cat "/$i" >"$dir/$host/$i"
  57.     done
  58.   fi
  59. done
  60.  
  61. echo /proc/mounts
  62. perl -nl -e 'print unless (split)[0] =~ /none|automount|:/' /proc/mounts >"$dir/$host/proc/mounts"
  63.  
  64. echo -e "\n------  dmesg start  ------\n" >>"$dir/$host/var/log/boot.msg"
  65. dmesg >>"$dir/$host/var/log/boot.msg"
  66.  
  67. if [ -x /usr/bin/lshal ] ; then
  68.   echo lshal
  69.   lshal >$dir/$host/lshal.txt 2>/dev/null
  70. fi
  71.  
  72. file="$host.tar.gz"
  73. tar -C "$dir" -zcf "$dir/$file" "$host"
  74.  
  75. rm -f "/tmp/$file"
  76.  
  77. if [ -e "/tmp/$file" ] ; then
  78.   echo "Warning: /tmp/$file exists, no info written"\!
  79.   rm -rf "$dir"
  80.   exit 1
  81. fi
  82.  
  83. ln -nf "$dir/$file" "/tmp/$file"
  84.  
  85. rm -rf "$dir"
  86.  
  87. echo -e "\nSystem data written to: /tmp/$file"
  88.  
  89.