#!/bin/sh
#
#   hw_info.sh
#
#   Script to determine system configuration for bug reports.
#

PATH="/etc:/bin:/usr/bin:/sbin:/usr/sbin:$PATH"		; export PATH

LOGF="/tmp/hw_info_$$.spr"
PROF="cpuinfo interrupts ioports devices meminfo stat pci"

cp /dev/null ${LOGF}
for i in ${PROF}
do
    if [ -r /proc/$i ]; then
	echo "==== Info on $i ====" >> ${LOGF}
    	cat /proc/$i >> ${LOGF}
    else
    	echo "==== Unable to report $i ====" >> ${LOGF}
    fi
    echo >> ${LOGF}
done
echo "Linux Kernel messages" >> ${LOGF}
echo >> ${LOGF}
dmesg >> ${LOGF}
echo "Configured network interfaces" >> ${LOGF}
ifconfig >> ${LOGF}
echo >> ${LOGF}

if [ "${SYBASE}" ]; then
    if [ -f ${SYBASE}/install/errorlog ]; then
	tail ${SYBASE}/install/errorlog >> ${LOGF}
    else
    	echo "$SYBASE/install/errorlog not found" >> ${LOGF}
    fi
fi

cat <<EOM

Your hw_info_<PID>.spr is available under ${LOGF}.
Please visit <http://linux.sybase.com/> to register or report trouble.
EOM
exit
