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
20 $APPNAME [-h|--help] [-g|--debug] [--temp-profile] [options] [URL]
22 -g or --debug Start within $GDB
23 -h or --help This help screen
24 --temp-profile Start with a new and temporary profile
26 Other supported options are:
29 See 'man $APPNAME' for more details
33 export LD_LIBRARY_PATH=$LIBDIR${LD_LIBRARY_PATH:+:"$LD_LIBRARY_PATH"}
35 # for to find xdg-settings
36 export PATH=$LIBDIR${PATH:+:"$PATH"}
38 # chromium needs /dev/shm being mounted
39 m=$(awk '$2 == "/dev/shm" && $3 == "tmpfs" {print}' /proc/mounts)
42 Chromium needs /dev/shm being mounted for Shared Memory access.
44 To do so, invoke (as root):
45 mount -t tmpfs -o rw,nosuid,nodev,noexec none /dev/shm
50 # lsb_release is slow so try to source the static file /etc/lsb-release
51 # instead, and fallback to lsb_release if we didn't get the information we need
52 if [ -e /etc/lsb-release ]; then
55 DIST=${DISTRIB_ID:-$(lsb_release -si)}
56 RELEASE=${DISTRIB_CODENAME:-$(lsb_release -sc)}
58 # Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
59 export CHROME_VERSION_EXTRA="$DIST Linux $RELEASE"
61 # Let the wrapped binary know that it has been run through the wrapper
62 export CHROME_WRAPPER="$(readlink -f "$0")"
64 # Google Chrome has a number of command line switches which change the behavior of Chrome
65 # This param allows you to set extra args for browser startup.
66 # See: http://peter.sh/experiments/chromium-command-line-switches/
67 CHROME_FLAGS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/chromium/Chrome Flags"
68 if [ -f "$CHROME_FLAGS_FILE" ]; then
69 # All lines starting with # are ignored
70 CHROMIUM_USER_FLAGS=$(grep -v '^#' "$CHROME_FLAGS_FILE")
73 # Prefer user defined CHROMIUM_USER_FLAGS (from env) over system
74 # default CHROMIUM_FLAGS (from /etc/chromium-browser/default).
75 CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"}
77 # Google guys cannot properly handle comma, so download speed/est is shown
78 # as not a number (NaN). Workaround that with LC_NUMERIC=C
81 # load PepperFlash if present
82 PEPFLASH=$(readlink -f $LIBDIR/../browser-plugins/PepperFlash)
83 if [ -f $PEPFLASH/manifest.ver ]; then
84 . $PEPFLASH/manifest.ver
85 CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ppapi-flash-path=$PEPFLASH/libpepflashplayer.so --ppapi-flash-version=$version"
90 while [ $# -gt 0 ]; do
101 -- ) # Stop option prcessing
109 if [ $want_temp_profile -eq 1 ]; then
110 TEMP_PROFILE=$(mktemp -d) || exit 1
111 CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
114 if [ $want_debug -eq 1 ]; then
115 if [ ! -x $GDB ]; then
116 die "Sorry, can't find usable $GDB. Please install it."
119 tmpfile=$(mktemp /tmp/chromiumargs.XXXXXX) || die "Cannot create temporary file"
120 trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
121 echo "set args $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
123 echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
125 echo "# GTK_PATH=$GTK_PATH"
126 echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
127 echo "# CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
128 echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
129 $GDB "$LIBDIR/$APPNAME" -x $tmpfile
131 if [ $want_temp_profile -eq 1 ]; then
136 if [ $want_temp_profile -eq 0 ]; then
137 exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
139 # we can't exec here as we need to clean-up the temporary profile
140 $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"