[PATCH] new mozilla.sh script for firefox
Jose M Rodriguez
josemi at freebsd.jazztel.es
Mon Feb 28 03:36:15 GMT 2005
>Submitter-Id: current-users
>Originator: Jose M Rodriguez
>Organization: Redes JM
>Confidential: no
>Synopsis: [PATCH] new mozilla.sh script for firefox
>Severity: serious
>Priority: medium
>Category: ports
>Class: sw-bug
>Release: FreeBSD 5.4-PRERELEASE i386
>Environment:
System: FreeBSD orion.redesjm.local 5.4-PRERELEASE FreeBSD 5.4-PRERELEASE #2: Sun Feb 27 20:13:39 CET 2005 root at orion.redesjm.local:/usr/obj/usr/src/sys/ORION i386
>Description:
Correct several bug introduced in latest script
- more_args instead of moreargs
- preserve target in moreargs
- add support for profiles in xremote
- don't use remote for more options
- full processing of mozilla documented options
This must work, but I haven't time now to make a package test,
test before connmit, please.
Also, I do the xremote ping() without profile. This may be done
with profile to make xremote support profiles.
>How-To-Repeat:
>Fix:
--- patch-firefox begins here ---
--- /usr/HEAD/ports/www/firefox/files/patch-browser_app_mozilla.in Fri Feb 25 09:42:38 2005
+++ files/patch-browser_app_mozilla.in Mon Feb 28 04:20:24 2005
@@ -1,37 +1,9 @@
--- browser/app/mozilla.in.orig Tue Oct 26 11:26:11 2004
-+++ browser/app/mozilla.in Wed Feb 23 11:09:49 2005
-@@ -28,52 +28,110 @@
- ## The script will setup all the environment voodoo needed to make
++++ browser/app/mozilla.in Mon Feb 28 04:17:49 2005
+@@ -29,51 +29,83 @@
## the mozilla-bin binary to work.
##
--
-+#!/bin/sh
-+#
-+# The contents of this file are subject to the Netscape Public License
-+# Version 1.0 (the "NPL"); you may not use this file except in
-+# compliance with the NPL. You may obtain a copy of the NPL at
-+# http://www.mozilla.org/NPL/
-+#
-+# Software distributed under the NPL is distributed on an "AS IS" basis,
-+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
-+# for the specific language governing rights and limitations under the
-+# NPL.
-+#
-+# The Initial Developer of this code under the NPL is Netscape
-+# Communications Corporation. Portions created by Netscape are
-+# Copyright (C) 1998 Netscape Communications Corporation. All Rights
-+# Reserved.
-+#
-+
-+# $from: mozilla.in,v 1.3.4.9 2004/10/26 09:26:11 bryner%brianryner.com Exp $
-+# Usage:
-+#
-+# $ mozilla [args]
-+#
-+# The script will setup all the environment voodoo needed to make
-+# the mozilla-bin binary to work.
-+#
-+
+
+#
+# MOZ_PIS, "Mozilla Plugable Init Scripts"
+# MOZ_PIS_ is the name space used
@@ -151,7 +123,7 @@
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
-@@ -82,149 +140,224 @@
+@@ -82,149 +114,284 @@
curdir=`dirname "$progname"`
progbase=`basename "$progname"`
run_moz="$curdir/run-mozilla.sh"
@@ -281,6 +253,36 @@
-case "${_optOne}" in
- -*)
- ;;
+- *)
+- _USE_EXIST=1
+- ;;
+-esac
+-
+-_optLast=
+-for i in "$@"; do
+- _optLast="${i}"
+-done #last arg
+-
+-if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
+- # Last argument seems to be a local file/directory
+- # Check, if it is absolutely specified (ie. /home/foo/file vs. ./file)
+- # If it is just "relatively" (./file) specified, make it absolutely
+- [ `expr "${_optLast}" : '/.*'` -eq 0 ] && _optLast="file://`pwd`/${_optLast}"
+-fi
+-################################################################ Parse Arguments
+-
+-########################################################################### Main
+-if [ $ALREADY_RUNNING -eq 1 ]; then
+- # There's an instance already running. Use it.
+- # Any command line args passed in?
+- if [ $# -gt 0 ]; then
+- # There were "some" command line args.
+- if [ ${_USE_EXIST} -eq 1 ]; then
+- # We should use an existing instance, as _USE_EXIST=$_USE_EXIST=-1
+- _remote_cmd="openURL(${_optLast})"
+- "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "${_remote_cmd}"
+- unset _remote_cmd
+- exit $?
+# parse options
+script_args= # null
+moreargs= # null
@@ -289,11 +291,11 @@
+do
+ if [ -n "${target}" ]; then
+ # well, this can't be the target if not last
-+ moreargs="${moreargs} ${target}"
++ moreargs="${moreargs} \"${target}\""
+ target= # null
+ fi
+ case "$1" in
-+ -p | --pure | -pure)
++ --pure | -pure)
+ MOZILLA_BIN="${MOZILLA_BIN}.pure"
+ shift
+ ;;
@@ -307,25 +309,25 @@
+ script_args="${script_args} -d $2"
+ shift 2
+ else
-+ "$0: ERROR, -d needs an argument. Exiting" 1>&2
++ "$0: ERROR, $1 needs an argument. Exiting" 1>&2
+ exit 1
+ fi
+ ;;
-+ -UILocale)
++ -[Uu][Ii][Ll]ocale)
+ if [ -n "$2" ]; then
+ uilocale="$2"
+ shift 2
+ else
-+ echo "$0: ERROR, -UILocale needs an argument. Exiting" 1>&2
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
+ exit 1
+ fi
+ ;;
-+ -UIRegion)
++ -[Uu][Ii][Rr]egion)
+ if [ -n "$2" ]; then
+ uiregion="$2"
+ shift 2
+ else
-+ echo "$0: ERROR, -UIRegion needs an argument. Exiting" 1>&2
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
+ exit 1
+ fi
+ ;;
@@ -344,47 +346,80 @@
+ moreargs="${moreargs} $1"
+ shift
+ ;;
-+ -chat | -edit | -webcal)
++ -addressbook | -chat | -edit | -webcal)
+ # don't use remote for this
+ ALREADY_RUNNING= # null
+ moreargs="${moreargs} $1"
+ shift
+ ;;
++ -chrome | -installer | -inspector | -jsconsole)
++ # don't use remote for this
++ ALREADY_RUNNING= # null
++ moreargs="${moreargs} $1"
++ shift
++ ;;
++ -[Pp]rofile[Mm]anager | -[Ss]elect[Pp]rofile | -[Pp]rofile[Ww]izard)
++ # don't use remote for this
++ ALREADY_RUNNING= # null
++ moreargs="${moreargs} $1"
++ shift
++ ;;
++ -[Cc]reate[Pp]rofile)
++ # don't use remote for this
++ ALREADY_RUNNING= # null
++ if [ -n "$2" ]; then
++ moreargs="${moreargs} $1 \"$2\""
++ shift 2
++ else
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
++ exit 1
++ fi
++ ;;
++ -[Pp])
++ if [ -n "$2" ]; then
++ moreargs="${moreargs} $1 \"$2\""
++ MOZ_CLIENT_PROGRAM="${MOZ_CLIENT_PROGRAM} -p \"$2\""
++ shift 2
++ else
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
++ exit 1
++ fi
++ ;;
++ -install-global-extension | -install-global-theme)
++ # don't use remote for this
++ ALREADY_RUNNING= # null
++ if [ `id -u` -eq 0 ]; then
++ if [ -n "$2" ]; then
++ moreargs="${moreargs} $1 \"$2\""
++ shift 2
++ else
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
++ exit 1
++ fi
++ else
++ echo "$0: ERROR, $1 needs be root. Exiting" 1>&2
++ fi
++ ;;
++ -lock-item | -unlock-item)
++ # don't use remote for this
++ ALREADY_RUNNING= # null
++ if [ `id -u` -eq 0 ]; then
++ if [ -n "$2" ]; then
++ moreargs="${moreargs} $1 \"$2\""
++ shift 2
++ else
++ echo "$0: ERROR, $1 needs an argument. Exiting" 1>&2
++ exit 1
+ fi
++ else
++ echo "$0: ERROR, $1 needs be root. Exiting" 1>&2
++ fi
++ ;;
+ -*)
+ moreargs="${moreargs} $1"
+ shift
+ ;;
- *)
-- _USE_EXIST=1
-- ;;
--esac
--
--_optLast=
--for i in "$@"; do
-- _optLast="${i}"
--done #last arg
--
--if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
-- # Last argument seems to be a local file/directory
-- # Check, if it is absolutely specified (ie. /home/foo/file vs. ./file)
-- # If it is just "relatively" (./file) specified, make it absolutely
-- [ `expr "${_optLast}" : '/.*'` -eq 0 ] && _optLast="file://`pwd`/${_optLast}"
--fi
--################################################################ Parse Arguments
--
--########################################################################### Main
--if [ $ALREADY_RUNNING -eq 1 ]; then
-- # There's an instance already running. Use it.
-- # Any command line args passed in?
-- if [ $# -gt 0 ]; then
-- # There were "some" command line args.
-- if [ ${_USE_EXIST} -eq 1 ]; then
-- # We should use an existing instance, as _USE_EXIST=$_USE_EXIST=-1
-- _remote_cmd="openURL(${_optLast})"
-- "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "${_remote_cmd}"
-- unset _remote_cmd
-- exit $?
-- fi
++ *)
+ target="$1"
+ shift
+ ;;
@@ -393,6 +428,7 @@
+
+# process target
+if [ -n "${target}" ]; then
++ moreargs="${moreargs} \"${target}\""
+ if [ `expr "${target}" : '.*:.*'` -eq 0 ]; then
+ if [ `expr "${target}" : '/.*'` -eq 0 ]; then
+ target="${here}/${target}"
@@ -469,19 +505,15 @@
+fi
+if [ -n "${uilocale}" ]; then
+ if [ -n "${uiregion}" ]; then
-+ moreargs="-UIRegion ${uiregion} ${more_args}"
++ moreargs="-UIRegion ${uiregion} ${moreargs}"
+ fi
-+ moreargs="-UILocale ${uilocale} ${more_args}"
++ moreargs="-UILocale ${uilocale} ${moreargs}"
+fi
-export MRE_HOME
-eval "set -- $moreargs"
+# real invocation
-+if [ -n "${target}" ]; then
-+ eval "set -- ${moreargs} \"${target}\""
-+else
-+ eval "set -- ${moreargs}"
-+fi
++eval "set -- ${moreargs}"
## Start addon scripts
moz_pis_startstop_scripts "start"
--- patch-firefox ends here ---
More information about the freebsd-gnome
mailing list