[banshee] osx: Add debug and logging facility to OS X booter (bgo#664574)



commit 3ab5fa4647e74e9c74c5fc965f6d902123fc3f47
Author: Timo DÃrr <timo latecrew de>
Date:   Wed Jun 20 13:02:57 2012 +0200

    osx: Add debug and logging facility to OS X booter (bgo#664574)
    
    Additional debug flags like --debug-sql and --redirect-log did not work
    because they were simply not present in the banshee.darwin.in booter
    template. Added the required parts from the banshee.linux.in booter
    template and adjusted to OS X.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 src/Clients/Booter/banshee.darwin.in |   48 +++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/src/Clients/Booter/banshee.darwin.in b/src/Clients/Booter/banshee.darwin.in
index d4b3c0a..068befc 100644
--- a/src/Clients/Booter/banshee.darwin.in
+++ b/src/Clients/Booter/banshee.darwin.in
@@ -96,4 +96,50 @@ if [ ! "$APP_ROOT" = "$PREVIOUS_APP_ROOT" ]; then
 	echo "$APP_ROOT" > "$BANSHEE_CONFIG_DIR/app-bundle-location"
 fi
 
-exec -a $BANSHEE_EXEC_NAME "$MONO_BIN" $MONO_OPTIONS "$MONO_EXE" $BANSHEE_OPTIONS
+# set and handle debug parameters
+[ -n "$BANSHEE_DEBUG" -o -f "${BANSHEE_CONFIG_DIR}/always-debug" ] && BANSHEE_DEBUG="--debug"
+[ -n "$BANSHEE_TRACE" ] && BANSHEE_TRACE="--trace=$BANSHEE_TRACE"
+[ -n "$BANSHEE_PROFILE" ] && BANSHEE_PROFILE="--profile=$BANSHEE_PROFILE"
+
+for arg in $*; do
+	case "x--debug" in ("x$arg")
+		BANSHEE_DEBUG=$arg
+	esac
+
+	case "x--trace=" in ("x${arg:0:8}")
+		BANSHEE_TRACE=$arg
+	esac
+
+	case "x--profile=" in ("x${arg:0:10}")
+		BANSHEE_PROFILE=$arg
+	esac
+
+	case "x--redirect-log" in ("x$arg")
+		# OS X has no "pidof" so get its execution name
+		BANSHEE_PID=`ps wwax | egrep -i "[B]anshee" | awk '{ print $1 }'`;
+		[ -z "$BANSHEE_PID" ] && BANSHEE_REDIRECT_LOG="${BANSHEE_CONFIG_DIR}/log"
+	esac
+
+	case "x--client=" in ("x${arg:0:9}")
+		BANSHEE_CLIENT="${arg:9}"
+	esac
+done
+
+if [ ! -z "$BANSHEE_CLIENT" ]; then
+	BANSHEE_CLIENT="--client=${BANSHEE_CLIENT}"
+fi
+
+if [ -n "$BANSHEE_DEBUG" -o -n "$BANSHEE_TRACE" -o -n "$BANSHEE_PROFILE" ]; then
+	MONO_OPTIONS="$BANSHEE_DEBUG $BANSHEE_TRACE $BANSHEE_PROFILE"
+	echo "** Running Mono with $MONO_OPTIONS **"
+fi
+
+# Finally - environment is set up, time to run our beloved
+exec_args="-a $BANSHEE_EXEC_NAME $MONO_BIN $MONO_OPTIONS $MONO_EXE $BANSHEE_DEBUG $BANSHEE_CLIENT $BANSHEE_OPTIONS"
+
+if [ -z "$BANSHEE_REDIRECT_LOG" ]; then
+	exec $exec_args "$@"
+else
+	mkdir -p `dirname "$BANSHEE_REDIRECT_LOG"`
+	(echo "exec $exec_args " "$@"; echo; exec $exec_args "$@") &> $BANSHEE_REDIRECT_LOG
+fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]