File chrome-wrapper of Package chromium-square


# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Running Chromium via this script makes it possible to set Chromium as the
# default browser directly out of a compile, without needing to package it.


# Checks a file to see if it's a 32 or 64-bit.
check_executable() {
    out=$(file $(readlink -f $1) 2> /dev/null)
    echo $out | grep -qs "ELF 32-bit LSB"
    if [ $? = 0 ]; then
        echo 32
    echo $out | grep -qs "ELF 64-bit LSB"
    if [ $? = 0 ]; then
        echo 64
    echo neither

# Let the wrapped binary know that it has been run through the wrapper.
export CHROME_WRAPPER="`readlink -f "$0"`"

HERE="`dirname "$CHROME_WRAPPER"`"

# We include some xdg utilities next to the binary, and we want to prefer them
# over the system versions because we know they work correctly for us. But if
# our path already exists, we leave it where it is, to allow overriding this.
# (Once distributions have picked up the updated xdg-mime, we can go back to
# appending $HERE rather than prepending.)
case ":$PATH:" in
    # $PATH already contains $HERE, leave it where it is.
    # Prepend $HERE to $PATH.
    export PATH="$HERE:$PATH"


exec "$HERE/chrome" "$@"