arg=$1
shift
-prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
-if [ -z "$prefix" ] ; then
+if [ -f "config.status" ] ; then
+ prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
+fi
+if [ -f "config.status" -a -z "$prefix" ] ; then
prefix=$(cat config.status | grep '"prefix"' | awk -F\" '{print $4}')
fi
-if [ -z "$prefix" ] ; then
+if [ -z "$prefix" -a -d "/usr/local/freeswitch" ] ; then
prefix="/usr/local/freeswitch"
fi
+if [ -z "$prefix" -a -d "/opt/freeswitch" ] ; then
+ prefix="/opt/freeswitch"
+fi
+if [ -z "$prefix" ] ; then
+ echo "Unable to locate freeswitch prefix directory."
+ exit 255
+fi
if [ "$arg" = "gcore" ] ; then
user=$1
exit 255
fi
-if [ -z "which gdb" ] ; then
+if [ -x `which gdb` ] ; then
+ echo "Found gdb"
+else
echo "Unable to locate gdb, is it installed?"
exit 255
fi
echo "SVN INFO:" >> $post_file
echo $line >> $post_file
echo -n "Revision: " >> $post_file
-svnversion . >> $post_file
-svn stat | grep -v \? >> $post_file
+if [ -d ".svn" ] ; then
+ svnversion . >> $post_file
+ svn stat | grep -v \? >> $post_file
+else
+ echo "Not run from an svn managed directory." >> $post_file
+fi
echo "GDB BACKTRACE:" >> $post_file
echo $line >> $post_file