From a5f2b5f82cb76998262296c088fb2f29bdc92b03 Mon Sep 17 00:00:00 2001 From: "mconnor%myrealbox.com" Date: Sun, 30 May 2004 17:58:39 +0000 Subject: [PATCH] reland script from 177996 with adjust from bz to use new ping() format --- browser/app/mozilla.in | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/browser/app/mozilla.in b/browser/app/mozilla.in index 20d148b74d3c..7c09f1a0f814 100755 --- a/browser/app/mozilla.in +++ b/browser/app/mozilla.in @@ -16,7 +16,7 @@ # Reserved. # -## $Id: mozilla.in,v 1.3 2004/02/20 18:13:45 pkw%us.ibm.com Exp $ +## $Id: mozilla.in,v 1.4 2004/05/30 17:58:39 mconnor%myrealbox.com Exp $ ## ## Usage: ## @@ -119,6 +119,28 @@ moreargs="" debugging=0 MOZILLA_BIN="%MOZILLA-BIN%" +# The following is to check for a currently running instance. +# This is taken almost verbatim from the Mozilla RPM package's launch script. +MOZ_CLIENT_PROGRAM=$curdir/mozilla-xremote-client +function check_running() { + $MOZ_CLIENT_PROGRAM -a firefox 'ping()' 2>/dev/null >/dev/null + RETURN_VAL=$? + if [ "$RETURN_VAL" -eq "2" ]; then + echo 0 + return 0 + else + echo 1 + return 1 + fi +} + +ALREADY_RUNNING=`check_running` + +if [ "${ALREADY_RUNNING}" -eq "1" ] && [ -z "$1" ]; then + exec $MOZ_CLIENT_PROGRAM "xfeDoCommand(openBrowser)" 2>/dev/null >/dev/null +fi +# End of section that checks for currently running instance. - jtg + if [ "$OSTYPE" = "beos" ]; then mimeset -F $MOZILLA_BIN fi