build/unix/mozilla.in

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 #!/bin/sh
     2 #
     3 # This Source Code Form is subject to the terms of the Mozilla Public
     4 # License, v. 2.0. If a copy of the MPL was not distributed with this
     5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7 ## 
     8 ## Usage:
     9 ##
    10 ## $ mozilla [args]
    11 ##
    12 ## This script is meant to run the application binary from mozilla/dist/bin.
    13 ##
    14 ## The script will setup all the environment voodoo needed to make
    15 ## the application binary to work.
    16 ##
    18 #uncomment for debugging
    19 #set -x
    21 moz_libdir=%MOZAPPDIR%
    23 # Use run-mozilla.sh in the current dir if it exists
    24 # If not, then start resolving symlinks until we find run-mozilla.sh
    25 found=0
    26 progname="$0"
    27 curdir=`dirname "$progname"`
    28 progbase=`basename "$progname"`
    29 run_moz="$curdir/run-mozilla.sh"
    30 if test -x "$run_moz"; then
    31   dist_bin="$curdir"
    32   found=1
    33 else
    34   here=`/bin/pwd`
    35   while [ -h "$progname" ]; do
    36     bn=`basename "$progname"`
    37     cd `dirname "$progname"`
    38     # Resolve symlink of dirname
    39     cd `/bin/pwd`
    40     progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
    41     progbase=`basename "$progname"`
    42     if [ ! -x "$progname" ]; then
    43       break
    44     fi
    45     curdir=`dirname "$progname"`
    46     run_moz="$curdir/run-mozilla.sh"
    47     if [ -x "$run_moz" ]; then
    48       cd "$curdir"
    49       dist_bin=`/bin/pwd`
    50       run_moz="$dist_bin/run-mozilla.sh"
    51       found=1
    52       break
    53     fi
    54   done
    55   cd "$here"
    56 fi
    57 if [ $found = 0 ]; then
    58   # Check default compile-time libdir
    59   if [ -x "$moz_libdir/run-mozilla.sh" ]; then
    60     dist_bin="$moz_libdir"
    61     run_moz="$moz_libdir/run-mozilla.sh"
    62   else
    63     echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
    64     exit 1
    65   fi
    66 fi
    68 script_args=""
    69 debugging=0
    70 MOZILLA_BIN="${progbase}-bin"
    72 if [ "$OSTYPE" = "beos" ]; then
    73   mimeset -F "$MOZILLA_BIN"
    74 fi
    76 pass_arg_count=0
    77 while [ $# -gt $pass_arg_count ]
    78 do
    79   case "$1" in
    80     -p | --pure | -pure)
    81       MOZILLA_BIN="${MOZILLA_BIN}.pure"
    82       shift
    83       ;;
    84     -g | --debug)
    85       script_args="$script_args -g"
    86       debugging=1
    87       shift
    88       ;;
    89     -d | --debugger)
    90       script_args="$script_args -d $2"
    91       shift 2
    92       ;;
    93     *)
    94       # Move the unrecognized argument to the end of the list.
    95       arg="$1"
    96       shift
    97       set -- "$@" "$arg"
    98       pass_arg_count=`expr $pass_arg_count + 1`
    99       ;;
   100   esac
   101 done
   103 if [ $debugging = 1 ]
   104 then
   105   echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
   106 fi
   107 exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
   108 # EOF.

mercurial