2 APPNAME=chromium-browser
6 # Allow the user to override command-line flags, http://bugs.gentoo.org/357629
7 # This is based on Debian's chromium-browser package, and is intended
8 # to be consistent with Debian.
9 if [ -f /etc/$APPNAME/default ] ; then
10 . /etc/$APPNAME/default
19 echo "$APPNAME [-h|--help] [-g|--debug] [--temp-profile] [options] [URL]"
21 echo " -g or --debug Start within $GDB"
22 echo " -h or --help This help screen"
23 echo " --temp-profile Start with a new and temporary profile"
25 echo "Other supported options are:"
26 MANWIDTH=80 man $APPNAME | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
27 echo "See 'man $APPNAME' for more details"
30 export LD_LIBRARY_PATH=$LIBDIR${LD_LIBRARY_PATH:+:"$LD_LIBRARY_PATH"}
32 # for to find xdg-settings
33 export PATH=$LIBDIR${PATH:+:"$PATH"}
35 # chromium needs /dev/shm being mounted
36 m=$(awk '$2 == "/dev/shm" && $3 == "tmpfs" {print}' /proc/mounts)
39 Chromium needs /dev/shm being mounted for Shared Memory access.
41 To do so, invoke (as root):
42 mount -t tmpfs -o rw,nosuid,nodev,noexec none /dev/shm
47 # lsb_release is slow so try to source the static file /etc/lsb-release
48 # instead, and fallback to lsb_release if we didn't get the information we need
49 if [ -e /etc/lsb-release ] ; then
52 DIST=${DISTRIB_ID:-$(lsb_release -si)}
53 RELEASE=${DISTRIB_CODENAME:-$(lsb_release -sc)}
55 # Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
56 export CHROME_VERSION_EXTRA="$DIST Linux $RELEASE"
58 # Let the wrapped binary know that it has been run through the wrapper
59 export CHROME_WRAPPER="$(readlink -f "$0")"
61 # Google Chrome has a number of command line switches which change the behavior of Chrome
62 # This param allows you to set extra args for browser startup.
63 # See: http://peter.sh/experiments/chromium-command-line-switches/
64 CHROME_FLAGS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/chromium/Chrome Flags"
65 if [ -f "$CHROME_FLAGS_FILE" ]; then
66 # All lines starting with # are ignored
67 CHROMIUM_USER_FLAGS=$(grep -v '^#' "$CHROME_FLAGS_FILE")
70 # Prefer user defined CHROMIUM_USER_FLAGS (from env) over system
71 # default CHROMIUM_FLAGS (from /etc/chromium-browser/default).
72 CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"}
74 # Google guys cannot properly handle comma, so download speed/est is shown
75 # as not a number (NaN). Workaround that with LC_NUMERIC=C
78 # load PepperFlash if present
79 PEPFLASH=$(readlink -f $LIBDIR/../browser-plugins/PepperFlash)
80 if [ -f $PEPFLASH/manifest.ver ]; then
81 . $PEPFLASH/manifest.ver
82 CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ppapi-flash-path=$PEPFLASH/libpepflashplayer.so --ppapi-flash-version=$version"
87 while [ $# -gt 0 ]; do
98 -- ) # Stop option prcessing
106 if [ $want_temp_profile -eq 1 ]; then
107 TEMP_PROFILE=$(mktemp -d) || exit 1
108 CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
111 if [ $want_debug -eq 1 ]; then
112 if [ ! -x $GDB ] ; then
113 die "Sorry, can't find usable $GDB. Please install it."
116 tmpfile=$(mktemp /tmp/chromiumargs.XXXXXX) || die "Cannot create temporary file"
117 trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
118 echo "set args $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
120 echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
122 echo "# GTK_PATH=$GTK_PATH"
123 echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
124 echo "# CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
125 echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
126 $GDB "$LIBDIR/$APPNAME" -x $tmpfile
128 if [ $want_temp_profile -eq 1 ]; then
133 if [ $want_temp_profile -eq 0 ]; then
134 exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
136 # we can't exec here as we need to clean-up the temporary profile
137 $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"