Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -e
- # Firefox launcher containing a Profile migration helper for
- # temporary profiles used during alpha and beta phases.
- # Authors:
- # Alexander Sack <asac@jwsdot.com>
- # Fabien Tassin <fta@sofaraway.org>
- # Steve Langasek <steve.langasek@canonical.com>
- # Chris Coulson <chris.coulson@canonical.com>
- # License: GPLv2 or later
- PROFILE=$HOME/.mozilla/firefox
- LIBDIR=/usr/lib/firefox-4.0
- NAME=`which $0`
- MOZ_APP_LAUNCHER=$NAME
- SERIES=4.0
- DISPLAYNAME="Firefox"
- EXE=firefox-bin
- APPNAME=firefox
- export MOZ_APP_LAUNCHER
- while [ ! -x $LIBDIR/$EXE ] ; do
- if [ -L "$NAME" ] ; then
- NAME=`readlink -f $NAME`
- LIBDIR=`dirname $NAME`
- else
- echo "Can't find $LIBDIR/$EXE"
- exit 1
- fi
- done
- usage () {
- $LIBDIR/$EXE -h | sed -e 's,/.*/,,'
- echo
- echo " -g or --debug Start within debugger"
- echo " -d or --debugger Specify debugger to start with (eg, gdb or valgrind)"
- echo " -a or --debugger-args Specify arguments for debugger"
- }
- moz_debug=0
- moz_debugger_args=""
- moz_debugger="gdb"
- while [ $# -gt 0 ]; do
- case "$1" in
- -h | --help )
- usage
- exit 0
- ;;
- -g | --debug )
- moz_debug=1
- shift
- ;;
- -d | --debugger)
- moz_debugger=$2;
- if [ "${moz_debugger}" != "" ]; then
- shift 2
- else
- echo "-d requires an argument"
- exit 1
- fi
- ;;
- -a | --debugger-args )
- moz_debugger_args=$2;
- if [ "${moz_debugger_args}" != "" ] ; then
- shift 2
- else
- echo "-a requires an argument"
- exit 1
- fi
- ;;
- -- ) # Stop option processing
- shift
- break
- ;;
- * )
- break
- ;;
- esac
- done
- if [ -x $LIBDIR/xulapp-profilemigrator ] ; then
- RUN_MIGRATOR=0
- if [ ! -d $PROFILE ] ; then
- RUN_MIGRATOR=1
- elif [ -f $PROFILE.last-version ] ; then
- last_series=`cat $PROFILE.last-version`
- if [ $SERIES != $last_series ] ; then
- RUN_MIGRATOR=1
- fi
- else
- RUN_MIGRATOR=1
- fi
- if [ "$RUN_MIGRATOR" = "1" ] ; then
- $LIBDIR/xulapp-profilemigrator -s $SERIES -p $PROFILE -d $DISPLAYNAME -a $APPNAME
- fi
- fi
- LD_LIBRARY_PATH=${LIBDIR}:${LIBDIR}/plugins${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}
- export LD_LIBRARY_PATH
- if [ $moz_debug -eq 1 ] ; then
- debugger=`which $moz_debugger`
- if [ ! -x $debugger ] ; then
- echo "Invalid debugger"
- exit 1
- fi
- case `basename $debugger` in
- gdb)
- exec $debugger $moz_debugger_args --args $LIBDIR/$EXE "$@"
- ;;
- valgrind)
- exec $debugger $moz_debugger_args $LIBDIR/$EXE "$@"
- ;;
- *)
- exec $debugger $moz_debugger_args $LIBDIR/$EXE "$@"
- ;;
- esac
- else
- exec $LIBDIR/$EXE "$@"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement