Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 May 2012 20:25:05 +0000
From:      tzabal@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r236317 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport
Message-ID:  <20120524202505.BFBE410656D5@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tzabal
Date: Thu May 24 20:25:05 2012
New Revision: 236317
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236317

Log:
  Forgot to svn add usr.bin/crashreport in the previous commit.

Added:
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile
  soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh   (contents, props changed)

Added: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile	Thu May 24 20:25:05 2012	(r236317)
@@ -0,0 +1,3 @@
+SCRIPTS= crashreport.sh
+
+.include <bsd.prog.mk>

Added: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh	Thu May 24 20:25:05 2012	(r236317)
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+print_usage()
+{
+	echo "usage: $(basename $0) [-d dumpdir] [-f file] [-e email]"
+}
+
+# Default dump directory
+DUMPDIR='/var/crash'
+
+dumpdir=
+file=
+email=
+
+while getopts "d:f:e:" opt; do
+	case "$opt" in
+	d)
+		dumpdir=$OPTARG
+		;;
+	f)
+		file=$OPTARG
+		;;
+	e)
+		email=$OPTARG
+		;;
+	*)
+		print_usage
+		exit 1
+		;;
+	esac
+done
+
+
+if [ -z "${dumpdir}" ]; then
+	if [ -d "${DUMPDIR}" ]; then
+		dumpdir=${DUMPDIR}
+	else
+		echo "Dump directory does not exist."
+		exit 1
+	fi
+fi
+
+
+BOUNDS="${dumpdir}/bounds"
+CORETXT="${dumpdir}/core.txt"
+TEXTDUMPTAR="${dumpdir}/textdump.tar"
+X=
+
+if [ -z "`ls ${dumpdir}`" ]; then
+	echo "The dump directory is empty."
+	exit 2
+fi
+
+
+if [ -z "${file}" ]; then
+	if [ -f "${BOUNDS}" ]; then
+		value=`head -n 1 ${BOUNDS}`
+		X=$((value - 1))
+		if [ -f "${CORETXT}.${X}" ]; then
+			file=`basename "${CORETXT}.${X}"`
+		elif [ -f "${TEXTDUMPTAR}.${X}" ]; then
+			file=`basename "${TEXTDUMPTAR}.${X}"`
+		else
+			echo "Unable to locate generated debugging information."
+			exit 3
+		fi
+	else
+		tmp=`ls | grep '[a-z]*\.[a-z]*\.\w*' | sort -n -t . -k 3 | tail -1`
+		file=`basename "${tmp}"`
+	fi
+fi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120524202505.BFBE410656D5>