From ab9299bc37a9d3c2f705e8c0f2c30dbec47eaf66 Mon Sep 17 00:00:00 2001
From: Rupa Schomaker <rupa@rupa.com>
Date: Mon, 1 Feb 2010 15:29:40 +0000
Subject: [PATCH] don't check config.status if it doesn't exist add
 /opt/freeswitch as a prefix to test fix test for gdb don't run svn stuff if
 not in a svn managed directory

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16544 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 support-d/fscore_pb | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/support-d/fscore_pb b/support-d/fscore_pb
index 7f520650d2..bad96afce4 100755
--- a/support-d/fscore_pb
+++ b/support-d/fscore_pb
@@ -3,14 +3,23 @@
 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
@@ -38,7 +47,9 @@ if [ -z "$core" ] ; then
 	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
@@ -80,8 +91,12 @@ cat /proc/cpuinfo >> $post_file
 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