1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#!/bin/bash 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Copyright (c) 2011 The Chromium Authors. All rights reserved. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# found in the LICENSE file. 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Let the wrapped binary know that it has been run through the wrapper. 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)export CHROME_WRAPPER="`readlink -f "$0"`" 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)HERE="`dirname "$CHROME_WRAPPER"`" 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)# Check if the CPU supports SSE2. If not, try to pop up a dialog to explain the 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)# problem and exit. Otherwise the browser will just crash with a SIGILL. 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)# http://crbug.com/348761 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)grep ^flags /proc/cpuinfo|grep -qs sse2 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)if [ $? != 0 ]; then 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) SSE2_DEPRECATION_MSG="This computer can no longer run Google Chrome because \ 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)its hardware is no longer supported." 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) if which zenity &> /dev/null; then 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) zenity --warning --text="$SSE2_DEPRECATION_MSG" 21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) elif which gmessage &> /dev/null; then 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) gmessage "$SSE2_DEPRECATION_MSG" 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) elif which xmessage &> /dev/null; then 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) xmessage "$SSE2_DEPRECATION_MSG" 25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) else 26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) echo "$SSE2_DEPRECATION_MSG" 1>&2 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) fi 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) exit 1 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)fi 30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# We include some xdg utilities next to the binary, and we want to prefer them 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# over the system versions when we know the system versions are very old. We 33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# detect whether the system xdg utilities are sufficiently new to be likely to 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# work for us by looking for xdg-settings. If we find it, we leave $PATH alone, 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# so that the system xdg utilities (including any distro patches) will be used. 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if ! which xdg-settings &> /dev/null; then 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) # Old xdg utilities. Prepend $HERE to $PATH to use ours instead. 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) export PATH="$HERE:$PATH" 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)else 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) # Use system xdg utilities. But first create mimeapps.list if it doesn't 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) # exist; some systems have bugs in xdg-mime that make it fail without it. 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}" 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) mkdir -p "$xdg_app_dir" 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list" 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# Always use our versions of ffmpeg libs. 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# This also makes RPMs find the compatibly-named library symlinks. 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)if [[ -n "$LD_LIBRARY_PATH" ]]; then 50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) LD_LIBRARY_PATH="$HERE:$HERE/lib:$LD_LIBRARY_PATH" 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)else 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) LD_LIBRARY_PATH="$HERE:$HERE/lib" 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)fi 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)export LD_LIBRARY_PATH 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)export CHROME_VERSION_EXTRA="@@CHANNEL@@" 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# We don't want bug-buddy intercepting our crashes. http://crbug.com/24120 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 61d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)# Automagically migrate user data directory. 62d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)# TODO(phajdan.jr): Remove along with migration code in the browser for M33. 63d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)if [[ -n "@@SXS_USER_DATA_DIR@@" ]]; then 64d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) if [[ ! -d "@@SXS_USER_DATA_DIR@@" ]]; then 65d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) "$HERE/@@PROGNAME@@" "--migrate-data-dir-for-sxs=@@SXS_USER_DATA_DIR@@" \ 66d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) --enable-logging=stderr --log-level=0 67d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) fi 68d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)fi 69d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 704ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch# Make sure that the profile directory specified in the environment, if any, 714ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch# overrides the default. 724ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdochif [[ -n "$CHROME_USER_DATA_DIR" ]]; then 734ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch PROFILE_DIRECTORY_FLAG="--user-data-dir=$CHROME_USER_DATA_DIR" 744ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdochfi 754ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch 7646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)# Sanitize std{in,out,err} because they'll be shared with untrusted child 7746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)# processes (http://crbug.com/376567). 7846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)exec < /dev/null 7946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)exec > >(exec cat) 8046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)exec 2> >(exec cat >&2) 8146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)# Note: exec -a below is a bashism. 834ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdochexec -a "$0" "$HERE/@@PROGNAME@@" @@DEFAULT_FLAGS@@ "$PROFILE_DIRECTORY_FLAG" \ 844ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch "$@" 85