MozillaFirefox/mozilla.sh.in
changeset 5 17b1dd932700
child 212 f25759227036
equal deleted inserted replaced
4:523b1d92948c 5:17b1dd932700
       
     1 #!/bin/sh
       
     2 #
       
     3 # ***** BEGIN LICENSE BLOCK *****
       
     4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
       
     5 #
       
     6 # The contents of this file are subject to the Mozilla Public License Version
       
     7 # 1.1 (the "License"); you may not use this file except in compliance with
       
     8 # the License. You may obtain a copy of the License at
       
     9 # http://www.mozilla.org/MPL/
       
    10 #
       
    11 # Software distributed under the License is distributed on an "AS IS" basis,
       
    12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
       
    13 # for the specific language governing rights and limitations under the
       
    14 # License.
       
    15 #
       
    16 # The Original Code is mozilla.org Code.
       
    17 #
       
    18 # The Initial Developer of the Original Code is
       
    19 # Netscape Communications Corporation.
       
    20 # Portions created by the Initial Developer are Copyright (C) 1998
       
    21 # the Initial Developer. All Rights Reserved.
       
    22 #
       
    23 # Contributor(s): 
       
    24 #    Wolfgang Rosenauer <wolfgang.rosenauer@suse.de>
       
    25 #                       <wr@rosenauer.org>
       
    26 #
       
    27 # Alternatively, the contents of this file may be used under the terms of
       
    28 # either the GNU General Public License Version 2 or later (the "GPL"), or
       
    29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
       
    30 # in which case the provisions of the GPL or the LGPL are applicable instead
       
    31 # of those above. If you wish to allow use of your version of this file only
       
    32 # under the terms of either the GPL or the LGPL, and not to allow others to
       
    33 # use your version of this file under the terms of the MPL, indicate your
       
    34 # decision by deleting the provisions above and replace them with the notice
       
    35 # and other provisions required by the GPL or the LGPL. If you do not delete
       
    36 # the provisions above, a recipient may use your version of this file under
       
    37 # the terms of any one of the MPL, the GPL or the LGPL.
       
    38 #
       
    39 # ***** END LICENSE BLOCK *****
       
    40 
       
    41 ## 
       
    42 ## Usage:
       
    43 ##
       
    44 ## $ mozilla [args]
       
    45 ##
       
    46 ## This script is meant to run a mozilla program from the mozilla
       
    47 ## rpm installation.
       
    48 ##
       
    49 ## The script will setup all the environment voodoo needed to make
       
    50 ## mozilla work.
       
    51 
       
    52 cmdname=`basename $0`
       
    53 
       
    54 ##
       
    55 ## Variables
       
    56 ##
       
    57 MOZ_DIST_BIN="%PREFIX"
       
    58 MOZ_DIST_LIB="%PROGDIR"
       
    59 MOZ_APPNAME="%APPNAME"
       
    60 MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME"
       
    61 
       
    62 export MOZ_APP_LAUNCHER="$MOZ_DIST_LIB/$MOZ_APPNAME.sh"
       
    63 
       
    64 mozilla_lib=`file $MOZ_PROGRAM`
       
    65 LIB=lib
       
    66 echo $mozilla_lib | grep -q -E 'x86-64|s390x|64-bit.PowerPC' && LIB=lib64
       
    67 
       
    68 BROWSER_PLUGIN_DIR=/usr/$LIB/browser-plugins
       
    69 if [ ! -d $BROWSER_PLUGIN_DIR ]; then
       
    70   BROWSER_PLUGIN_DIR=/opt/netscape/plugins
       
    71 fi
       
    72 
       
    73 # ignore composite extension (needed for Flash)
       
    74 export XLIB_SKIP_ARGB_VISUALS=1
       
    75 
       
    76 # needed for SUN Java under Xorg >= 7.2
       
    77 export LIBXCB_ALLOW_SLOPPY_LOCK=1
       
    78 
       
    79 ##
       
    80 if [ -z "$MOZ_PLUGIN_PATH" ]; then
       
    81   export MOZ_PLUGIN_PATH=$BROWSER_PLUGIN_DIR
       
    82 else
       
    83   # make sure that BROWSER_PLUGIN_DIR is in MOZ_PLUGIN_PATH
       
    84   echo "$MOZ_PLUGIN_PATH" | grep "$BROWSER_PLUGIN_DIR" 2>&1 >/dev/null
       
    85   _retval=$?
       
    86   if [ ${_retval} -ne 0 ]; then
       
    87     export MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$BROWSER_PLUGIN_DIR
       
    88   fi
       
    89 fi
       
    90 
       
    91 # disable Gnome crash dialog (doesn't make sense anyway)
       
    92 export GNOME_DISABLE_CRASH_DIALOG=1
       
    93 
       
    94 moz_debug=0
       
    95 script_args=""
       
    96 pass_arg_count=0
       
    97 while [ $# -gt $pass_arg_count ]
       
    98 do
       
    99   case "$1" in
       
   100     -d | --debugger)
       
   101       moz_debugger=$2;
       
   102       if [ "${moz_debugger}" != "" ]; then
       
   103         shift 2
       
   104         moz_debug=1
       
   105       else
       
   106         echo "-d requires an argument"
       
   107         exit 1
       
   108       fi
       
   109       ;;
       
   110     *)
       
   111       # Move the unrecognized argument to the end of the list.
       
   112       arg="$1"
       
   113       shift
       
   114       set -- "$@" "$arg"
       
   115       pass_arg_count=`expr $pass_arg_count + 1`
       
   116       ;;
       
   117   esac
       
   118 done
       
   119 
       
   120 if [ $moz_debug -eq 1 ]; then
       
   121   tmpfile=`mktemp /tmp/mozargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
       
   122   trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
       
   123   echo -e "set args ${1+"$@"}\nrun" > $tmpfile
       
   124   echo "$moz_debugger $MOZ_PROGRAM -x $tmpfile"
       
   125   $moz_debugger "$MOZ_PROGRAM" -x $tmpfile
       
   126 else
       
   127   $MOZ_PROGRAM "$@"
       
   128 fi
       
   129 exitcode=$?
       
   130 
       
   131 exit $exitcode