aboutsummaryrefslogtreecommitdiffstats
path: root/src/extras/sysreport
diff options
context:
space:
mode:
Diffstat (limited to 'src/extras/sysreport')
-rwxr-xr-xsrc/extras/sysreport/functions4
-rwxr-xr-xsrc/extras/sysreport/sysreport.legacy104
2 files changed, 70 insertions, 38 deletions
diff --git a/src/extras/sysreport/functions b/src/extras/sysreport/functions
index 74061d18..fff52ccd 100755
--- a/src/extras/sysreport/functions
+++ b/src/extras/sysreport/functions
@@ -48,14 +48,14 @@ getpciinfo() {
catiffile() {
if [ -d $1 ]; then
- /bin/cp -x --parents -R $1 $ROOT 2>>$ROOT/$log
+ /bin/cp -p -x --parents -R $1 $ROOT 2>>$ROOT/$log
find $ROOT/$1 -type b -o -type c | xargs rm -f 2>/dev/null || :
echo -n $STATUS
echo_success
return 1
fi
if [ -f $1 ]; then
- /bin/cp --parents $1 $ROOT 2>>$ROOT/$log
+ /bin/cp -p --parents $1 $ROOT 2>>$ROOT/$log
echo -n $STATUS
echo_success
return 1
diff --git a/src/extras/sysreport/sysreport.legacy b/src/extras/sysreport/sysreport.legacy
index 4a41f803..043ba026 100755
--- a/src/extras/sysreport/sysreport.legacy
+++ b/src/extras/sysreport/sysreport.legacy
@@ -13,6 +13,7 @@ umask 0077
UTILDIR=/usr/share/sysreport
VER=`/bin/uname -r`
PATH=""
+PROGNAME="sysreport"
DATE=`/bin/date -u +%G%m%d%k%M%S | /usr/bin/tr -d ' '`
function usage {
@@ -26,17 +27,24 @@ function usage {
echo " -help : show help"
echo " -norpm : omit collecting information about currently installed packages"
echo " -dmidecode: enable dmidecode, getting information about the hardware"
+ echo " -firewall : collecting the system firewall rules"
+ echo " -home : place sysreport outputs within home directory"
+ echo " -usesysrq : collecting information about sysrq-trigger"
echo
exit 0
}
-[ $# -lt 3 ] || usage
+[ $# -lt 6 ] || usage
for i
do
case "$i" in
-help) usage;;
-norpm) NORPM=yes;;
-dmidecode) DMIDECODE=yes;;
+ -firewall) FIREWALL=yes;;
+ -home) HOMEDIR=yes;;
+ -sysrq) SYSRQ_TRIGGER=yes;;
+ -usesysrq) SYSRQ_TRIGGER=yes;;
*) usage;;
esac
done
@@ -52,8 +60,15 @@ if [ $UID != 0 ]; then
exit 1
fi
-ROOT=$HOME/sysreport-$DATE
-if ( ! mkdir $ROOT >& /dev/null ) ; then
+if [ "$HOMEDIR" = yes ] ; then
+ TEMPDIR=$HOME
+ ROOT=$HOME/sysreport-$DATE
+ /bin/mkdir $ROOT >& /dev/null
+else
+ TEMPDIR=/tmp
+ ROOT=`/bin/mktemp -dq /tmp/sysreport.XXXXXXXX`
+fi
+if [ $? != 0 ] ; then
echo "Cannot make temp dir"
exit 1
fi
@@ -197,7 +212,7 @@ STATUS="Collecting information about X:"
catiffile "/etc/X11"
STATUS="Gathering sysctl information (/proc/sys):"
-catiffile "/proc/sys"
+catifexec "/sbin/sysctl" "-a"
STATUS="Gathering sysctl information (/etc/sysctl.conf):"
catiffile "/etc/sysctl.conf"
@@ -380,6 +395,9 @@ catiffile "/etc/auto.net"
STATUS="Collecting LVM information:"
catifexec "/usr/sbin/vgdisplay" "-vv"
+STATUS="Gathering LVM setup"
+catiffile "/etc/lvm"
+
STATUS="Collecting SCSI Tape information (/etc/stinit.def)"
catiffile "/etc/stinit.def"
@@ -424,23 +442,25 @@ done
STATUS="Collecting information about ypbind configuration:"
catiffile "/etc/yp.conf"
-KERNELMIN=`/bin/uname -r | /bin/sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
-ipchainsmod=`/sbin/lsmod 2>/dev/null| /bin/grep ipchains`
-
-if [ "$KERNELMIN" -lt 3 ] || [ -n "${ipchainsmod}" ] ; then
- STATUS="Getting ipchains information:"
- catifexec "/sbin/ipchains" "-nvL"
-elif [ "$KERNELMIN" -gt 3 ]; then
- STATUS="Getting iptables information:"
- if [ -f /etc/sysconfig/iptables-config ] ; then
- catiffile "/etc/sysconfig/iptables-config"
+if [ "$FIREWALL" == "yes" ]; then
+ KERNELMIN=`/bin/uname -r | /bin/sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`
+ ipchainsmod=`/sbin/lsmod 2>/dev/null| /bin/grep ipchains`
+
+ if [ "$KERNELMIN" -lt 3 ] || [ -n "${ipchainsmod}" ] ; then
+ STATUS="Getting ipchains information:"
+ catifexec "/sbin/ipchains" "-nvL"
+ elif [ "$KERNELMIN" -gt 3 ]; then
+ STATUS="Getting iptables information:"
+ if [ -f /etc/sysconfig/iptables-config ] ; then
+ catiffile "/etc/sysconfig/iptables-config"
+ fi
+ STATUS="Getting iptables information (filter):"
+ catifexec "/sbin/iptables" "-t filter -nvL"
+ STATUS="Getting iptables information (mangle):"
+ catifexec "/sbin/iptables" "-t mangle -nvL"
+ STATUS="Getting iptables information (nat):"
+ catifexec "/sbin/iptables" "-t nat -nvL"
fi
- STATUS="Getting iptables information (filter):"
- catifexec "/sbin/iptables" "-t filter -nvL"
- STATUS="Getting iptables information (mangle):"
- catifexec "/sbin/iptables" "-t mangle -nvL"
- STATUS="Getting iptables information (nat):"
- catifexec "/sbin/iptables" "-t nat -nvL"
fi
# ldap client and server config
@@ -583,23 +603,22 @@ for x in `/bin/ls -d /etc/cups/*.conf 2>/dev/null` ; do
catiffile "$x"
done
-STATUS="Getting information about printcap"
-catiffile "/etc/printcap"
-
echo
echo "Gathering information from system logs"
echo
STATUS="Collecting information from dmesg:"
catiffile "/var/log/dmesg"
-STATUS="Collecting information from /proc/sysrq-trigger"
-if [ -f /proc/sysrq-trigger -a -f /proc/sys/kernel/sysrq ] ; then
- sysr_state="$(/bin/cat /proc/sys/kernel/sysrq)"
- echo 1 > /proc/sys/kernel/sysrq
- for key in m p t ; do
- echo $key > /proc/sysrq-trigger
- done
- echo $sysr_state > /proc/sys/kernel/sysrq
+if [ "$SYSRQ_TRIGGER" == "yes" ]; then
+ STATUS="Collecting information from /proc/sysrq-trigger"
+ if [ -f /proc/sysrq-trigger -a -f /proc/sys/kernel/sysrq ] ; then
+ sysr_state="$(/bin/cat /proc/sys/kernel/sysrq)"
+ echo 1 > /proc/sys/kernel/sysrq
+ for key in m p t ; do
+ echo $key > /proc/sysrq-trigger
+ done
+ echo $sysr_state > /proc/sys/kernel/sysrq
+ fi
fi
for x in `/bin/ls /var/log/messages*` ; do
@@ -683,6 +702,7 @@ if [ -f $RHNDIR/systemid ] ; then
catiffile "$RHNDIR/systemid"
fi
fi
+
# Get hardware profile information (for verification with system state and RHN)
if [ -x /usr/share/rhn/up2date_client/hardware.py ] ; then
STATUS="Gathering RHN hardware profile information"
@@ -697,6 +717,7 @@ if [ -x /usr/bin/rhn-charsets ] ; then
catifexec "/usr/bin/rhn-charsets"
fi
+# Get SELinux information
echo
echo "Gathering information on SELinux setup"
echo
@@ -705,14 +726,25 @@ catifexec "/usr/sbin/sestatus"
catifexec "rpm" "-q -V selinux-policy-targeted"
catifexec "rpm" "-q -V selinux-policy-strict"
-cd $HOME
+cd $TEMPDIR
/bin/echo
/bin/echo -n "Please enter your case number (if you have one): "
-read CASENUM
+
+while read CASENUM
+do
+ case $CASENUM in
+ *[^0-9]*)
+ /bin/echo -e "\nError: Your input contains non-numeric characters!"
+ /bin/echo -e "Please enter your case number (if you have one): "
+ ;;
+ *)
+ break ;;
+ esac
+done
if [ ! $CASENUM ]; then
- NAME=$HOSTNAME.$DATE
+ NAME=$PROGNAME-$HOSTNAME.$DATE
else
- NAME="$HOSTNAME-$CASENUM.$DATE"
+ NAME="$PROGNAME-$HOSTNAME-$CASENUM.$DATE"
fi
/bin/rm -Rf $NAME
/bin/mv $ROOT $NAME
@@ -727,7 +759,7 @@ fi
/bin/rm -Rf $NAME
/bin/echo
-/bin/echo "Please send $HOME/${NAME}.${SUFFIX} to your support"
+/bin/echo "Please send $TEMPDIR/${NAME}.${SUFFIX} to your support"
/bin/echo "representative."
/bin/echo