f66ad85
#!/bin/bash
f66ad85
#
f66ad85
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
f66ad85
# Use of this source code is governed by a BSD-style license that can be
f66ad85
# found in the LICENSE file.
f66ad85
f66ad85
# Let the wrapped binary know that it has been run through the wrapper.
f66ad85
export CHROME_WRAPPER="`readlink -f "$0"`"
f66ad85
f66ad85
HERE="`dirname "$CHROME_WRAPPER"`"
f66ad85
f66ad85
# We include some xdg utilities next to the binary, and we want to prefer them
f66ad85
# over the system versions when we know the system versions are very old. We
f66ad85
# detect whether the system xdg utilities are sufficiently new to be likely to
f66ad85
# work for us by looking for xdg-settings. If we find it, we leave $PATH alone,
f66ad85
# so that the system xdg utilities (including any distro patches) will be used.
f66ad85
if ! which xdg-settings &> /dev/null; then
f66ad85
  # Old xdg utilities. Prepend $HERE to $PATH to use ours instead.
f66ad85
  export PATH="$HERE:$PATH"
f66ad85
else
f66ad85
  # Use system xdg utilities. But first create mimeapps.list if it doesn't
f66ad85
  # exist; some systems have bugs in xdg-mime that make it fail without it.
f66ad85
  xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}"
f66ad85
  mkdir -p "$xdg_app_dir"
f66ad85
  [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list"
f66ad85
fi
f66ad85
f66ad85
# Always use our versions of ffmpeg libs.
f66ad85
# This also makes RPMs find the compatibly-named library symlinks.
f66ad85
if [[ -n "$LD_LIBRARY_PATH" ]]; then
f66ad85
  LD_LIBRARY_PATH="$HERE:$HERE/lib:$LD_LIBRARY_PATH"
f66ad85
else
f66ad85
  LD_LIBRARY_PATH="$HERE:$HERE/lib"
f66ad85
fi
f66ad85
export LD_LIBRARY_PATH
f66ad85
f66ad85
export CHROME_VERSION_EXTRA="Built from source for @@BUILD_TARGET@@"
f66ad85
f66ad85
# We don't want bug-buddy intercepting our crashes. http://crbug.com/24120
f66ad85
export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME
f66ad85
693308c
# Allow users to override command-line options and prefer user defined
693308c
# CHROMIUM_USER_FLAGS from env over system wide CHROMIUM_FLAGS
693308c
[[ -f /etc/chromium/chromium.conf ]] && . /etc/chromium/chromium.conf
693308c
CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-$CHROMIUM_FLAGS}
693308c
f66ad85
CHROMIUM_DISTRO_FLAGS=" --enable-plugins \
f66ad85
                        --enable-extensions \
f66ad85
                        --enable-user-scripts \
f66ad85
                        --enable-printing \
278c627
                        --enable-gpu-rasterization \
f66ad85
                        --enable-sync \
f66ad85
                        --auto-ssl-client-auth @@EXTRA_FLAGS@@"
f66ad85
81c4d30
# Sanitize std{in,out,err} because they'll be shared with untrusted child
81c4d30
# processes (http://crbug.com/376567).
81c4d30
exec < /dev/null
81c4d30
exec > >(exec cat)
81c4d30
exec 2> >(exec cat >&2)
81c4d30
693308c
exec -a "$0" "$HERE/@@CHROMIUM_BROWSER_CHANNEL@@" $CHROMIUM_FLAGS $CHROMIUM_DISTRO_FLAGS "$@"