updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / chromium-browser-svn / chromium-browser.sh
blob56fe94d2b1c434688453a420f4a303de171cc897
1 #!/bin/sh
3 # Chromium launcher
5 # Authors:
6 # Fabien Tassin <fta@sofaraway.org>
7 # License: GPLv2 or later
9 APPNAME=chromium
10 LIBDIR=/usr/lib/chromium
11 GDB=/usr/bin/gdb
13 usage () {
14 echo "$APPNAME [-h|--help] [-g|--debug] [options] [URL]"
15 echo
16 echo " -g or --debug Start within $GDB"
17 echo " -h or --help This help screen"
18 echo
19 echo " Other supported options are:"
20 MANWIDTH=80 man chromium-browser | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
21 echo " See 'man chromium-browser' for more details"
24 # Prefer user defined CHROMIUM_USER_FLAGS (fron env) over system
25 # default CHROMIUM_FLAGS (from /etc/$APPNAME/default)
26 CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"}
28 # FFmpeg needs to know where its libs are located
29 if [ "Z$LD_LIBRARY_PATH" != Z ] ; then
30 LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH
31 else
32 LD_LIBRARY_PATH=$LIBDIR
34 export LD_LIBRARY_PATH
36 # For the Default Browser detection to work, we need to give access
37 # to xdg-settings. Also set CHROME_WRAPPER in case xdg-settings is
38 # not able to do anything useful
39 export PATH="$LIBDIR:$PATH"
40 export CHROME_WRAPPER=true
42 # Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
43 export CHROME_VERSION_EXTRA=Archlinux
45 want_debug=0
46 while [ $# -gt 0 ]; do
47 case "$1" in
48 -h | --help | -help )
49 usage
50 exit 0 ;;
51 -g | --debug )
52 want_debug=1
53 shift ;;
54 -- ) # Stop option prcessing
55 shift
56 break ;;
57 * )
58 break ;;
59 esac
60 done
62 if [ $want_debug -eq 1 ] ; then
63 if [ ! -x $GDB ] ; then
64 echo "Sorry, can't find usable $GDB. Please install it."
65 exit 1
67 tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
68 trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
69 echo "set args $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
70 echo "# Env:"
71 echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
72 echo "# PATH=$PATH"
73 echo "# GTK_PATH=$GTK_PATH"
74 echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
75 echo "# CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
76 echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
77 $GDB "$LIBDIR/$APPNAME" -x $tmpfile
78 exit $?
79 else
80 exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"