]>
Commit | Line | Data |
---|---|---|
bd7a3039 ER |
1 | #!/bin/sh |
2 | ||
37ceaf05 ER |
3 | # Allow the user to override command-line flags, http://bugs.gentoo.org/357629 |
4 | # This is based on Debian's chromium-browser package, and is intended | |
5 | # to be consistent with Debian. | |
6 | if [ -f /etc/chromium-browser/default ] ; then | |
7 | . /etc/chromium-browser/default | |
8 | fi | |
4edced9c ER |
9 | |
10 | # Always use our ffmpeg libs. | |
bc4d0afe ER |
11 | CHROMIUM_DIR=@libdir@ |
12 | export LD_LIBRARY_PATH=$CHROMIUM_DIR${LD_LIBRARY_PATH:+:"$LD_LIBRARY_PATH"} | |
4edced9c ER |
13 | |
14 | # for to find xdg-settings | |
15 | export PATH=@libdir@${PATH:+:"$PATH"} | |
16 | ||
17 | # chromium needs /dev/shm being mounted | |
18 | m=$(awk '$2 == "/dev/shm" && $3 == "tmpfs" {print}' /proc/mounts) | |
19 | if [ -z "$m" ]; then | |
20 | cat >&2 <<-'EOF' | |
21 | Chromium needs /dev/shm being mounted for Shared Memory access. | |
22 | ||
23 | To do so, invoke (as root): | |
24 | mount -t tmpfs -o rw,nosuid,nodev,noexec none /dev/shm | |
25 | ||
26 | EOF | |
bd7a3039 | 27 | fi |
4edced9c | 28 | |
07e314b1 ER |
29 | # lsb_release is slow so try to source the static file /etc/lsb-release |
30 | # instead, and fallback to lsb_release if we didn't get the information we need | |
31 | if [ -e /etc/lsb-release ] ; then | |
32 | . /etc/lsb-release | |
33 | fi | |
34 | DIST=${DISTRIB_ID:-$(lsb_release -si)} | |
35 | RELEASE=${DISTRIB_CODENAME:-$(lsb_release -sc)} | |
36 | ||
4edced9c | 37 | # Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version |
07e314b1 | 38 | export CHROME_VERSION_EXTRA="$DIST Linux $RELEASE" |
4edced9c | 39 | |
a153aaeb AM |
40 | # Let the wrapped binary know that it has been run through the wrapper |
41 | export CHROME_WRAPPER="$(readlink -f "$0")" | |
42 | ||
aa6a00d6 ER |
43 | # Google Chrome has a number of command line switches which change the behavior of Chrome |
44 | # This param allows you to set extra args for browser startup. | |
1693275a | 45 | # See: http://peter.sh/experiments/chromium-command-line-switches/ |
aa6a00d6 ER |
46 | CHROME_FLAGS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/chromium/Chrome Flags" |
47 | if [ -f "$CHROME_FLAGS_FILE" ]; then | |
48 | # All lines starting with # are ignored | |
37ceaf05 | 49 | CHROMIUM_USER_FLAGS=$(grep -v '^#' "$CHROME_FLAGS_FILE") |
aa6a00d6 ER |
50 | fi |
51 | ||
37ceaf05 ER |
52 | # Prefer user defined CHROMIUM_USER_FLAGS (from env) over system |
53 | # default CHROMIUM_FLAGS (from /etc/chromium-browser/default). | |
54 | CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} | |
55 | ||
1693275a | 56 | # Google guys cannot properly handle comma, so download speed/est is shown |
6a2c5f4d | 57 | # as not a number (NaN). Workaround that with LC_NUMERIC=C |
1693275a | 58 | export LC_NUMERIC=C |
6a2c5f4d | 59 | |
bc4d0afe | 60 | # load PepperFlash if present |
8fc86c7a ER |
61 | PEPFLASH=$(readlink -f $CHROMIUM_DIR/../browser-plugins/PepperFlash) |
62 | if [ -f $PEPFLASH/manifest.ver ]; then | |
63 | . $PEPFLASH/manifest.ver | |
64 | PEPPERFLASH_ARGS="--ppapi-flash-path=$PEPFLASH/libpepflashplayer.so --ppapi-flash-version=$version" | |
bc4d0afe ER |
65 | fi |
66 | ||
67 | exec $CHROMIUM_DIR/chromium-browser $PEPPERFLASH_ARGS $CHROMIUM_FLAGS "$@" |