Permalink
Browse files

Added STANDALONE scripts for boxee

  • Loading branch information...
1 parent be428b8 commit 85f6567a34546a6d4512f0724d6d9e4dfb3a68be @davebv committed Jan 8, 2010
Showing with 78 additions and 0 deletions.
  1. +6 −0 BOXEE.desktop
  2. +72 −0 boxee-standalone
View
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Boxee
+Comment=This session will start Boxee Media Center
+Exec=boxee-standalone
+TryExec=boxee-standalone
+Type=Application
View
@@ -0,0 +1,72 @@
+#!/bin/bash
+BOXEE_HOME=/opt/boxee
+BOXEE_PROC=Boxee
+BOXEE_HOME=${XBMC_HOME=${BOXEE_HOME}}
+export XBMC_HOME=${BOXEE_HOME}
+export BOXEE_HOME
+BOXEE_PID=/tmp/run-boxee.pid
+CURRENT_PATH=`pwd`
+ALREADY_RUN=0
+LC_ALL="en.gb"
+
+if [ -f ${BOXEE_PID} ] ; then
+ CURRENT_PID=`cat ${BOXEE_PID}`
+ COMPARE_PID=`ps -ef | grep run-boxee | grep -v grep | awk '{print $2}' | xargs`
+ for pid in ${COMPARE_PID}
+ do
+ if [ ${CURRENT_PID} -eq ${pid} ]; then
+ ALREADY_RUN=1
+ BLOCKING_PROC='run-boxee'
+ fi
+ done
+fi
+
+if [ ${ALREADY_RUN} -ne 1 ] && ps -ef | grep "./Boxee" | grep -v grep > /dev/null ; then
+ ALREADY_RUN=1
+ BLOCKING_PROC='boxee'
+fi
+
+if [ ${ALREADY_RUN} -ne 0 ]; then
+ echo "BOXEE is already running... (${BLOCKING_PROC})"
+ exit
+#else
+# echo $$ >${BOXEE_PID}
+# ${BOXEE_HOME}/${BOXEE_PROC} --standalone
+fi
+if which pulse-session; then
+ BOXEE="pulse-session ${BOXEE_HOME}/${BOXEE_PROC} --standalone \"$@\""
+else
+ BOXEE="${BOXEE_HOME}/${BOXEE_PROC} --standalone \"$@\""
+fi
+
+LOOP=1
+CRASHCOUNT=0
+LASTSUCCESSFULSTART=$(date +%s)
+ulimit -c unlimited
+while (( $LOOP ))
+do
+ $BOXEE
+ RET=$?
+ NOW=$(date +%s)
+ if (( ($RET >= 64 && $RET <=66) || $RET == 0 )); then # clean exit
+ LOOP=0
+ else # crash
+ DIFF=$((NOW-LASTSUCCESSFULSTART))
+ if (($DIFF > 60 )); then # Not on startup, ignore
+ LASTSUCESSFULSTART=$NOW
+ CRASHCOUNT=0
+ else # at startup, look sharp
+ CRASHCOUNT=$((CRASHCOUNT+1))
+ if (($CRASHCOUNT >= 3)); then # Too many, bail out
+ LOOP=0
+ echo "BOXEE has exited uncleanly 3 times in the ${DIFF}s. Something is probably wrong"
+ fi
+ fi
+ fi
+done
+
+pkill -9 Boxee
+${BOXEE_HOME}/give_me_my_mouse_back
+rm ${BOXEE_PID}
+
+

0 comments on commit 85f6567

Please sign in to comment.