Chromium Code Reviews| Index: build/update-linux-sandbox.sh |
| diff --git a/build/update-linux-sandbox.sh b/build/update-linux-sandbox.sh |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..8fc6eef86747eeb7144a04f9b72e38a516c00173 |
| --- /dev/null |
| +++ b/build/update-linux-sandbox.sh |
| @@ -0,0 +1,61 @@ |
| +#!/bin/sh |
| + |
| +# Copyright (c) 2012 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. |
| +BUILDTYPE=${BUILDTYPE:-"Debug"} |
|
cmp
2012/06/05 22:54:20
nit: really the empty line should happen before BU
jln (very slow on Chromium)
2012/06/05 23:01:44
I think there was a race condition, I had already
|
| +CHROME_SRC_DIR=${CHROME_SRC_DIR:-$(dirname $(readlink -fn $0))/..} |
| +CHROME_OUT_DIR="${CHROME_SRC_DIR}/out/${BUILDTYPE}" |
| +chrome_sandbox_build_path="${CHROME_OUT_DIR}/chrome_sandbox" |
| +# Make sure the path below is not on NFS! |
| +chrome_sandbox_installed_path="/usr/local/sbin/chrome-devel-sandbox" |
| + |
| +if [ ! -d "$CHROME_OUT_DIR" ]; then |
| + echo -n "$CHROME_OUT_DIR does not exist. Use \"BUILDTYPE=Release ${0}\" " |
| + echo "If you are building in Release mode" |
| + exit 1 |
| +fi |
| + |
| +if [ ! -f "$chrome_sandbox_build_path" ]; then |
| + echo -n "Could not find $chrome_sandbox_build_path, " |
| + echo "please make sure you build the chrome_sandbox target" |
| + exit 1 |
| +fi |
| + |
| +installsandbox() { |
| + sudo -- cp "$chrome_sandbox_build_path" "$chrome_sandbox_installed_path" && |
| + sudo -- chown root:root "$chrome_sandbox_installed_path" && |
| + sudo -- chmod 4755 "$chrome_sandbox_installed_path" |
| + return $? |
| +} |
| + |
| +if [ ! -f "$chrome_sandbox_installed_path" ]; then |
| + echo -n "Could not find $chrome_sandbox_installed_path, " |
| + echo "installing it now." |
| + installsandbox |
| +fi |
| + |
| +if [ ! -f "$chrome_sandbox_installed_path" ]; then |
| + echo "Failed to install $chrome_sandbox_installed_path" |
| + exit 1 |
| +fi |
| + |
| +current_api=$($chrome_sandbox_build_path --get-api) |
| +installed_api=$($chrome_sandbox_installed_path --get-api) |
| + |
| +if [ x$current_api != x$installed_api ]; then |
| + echo -n "Your installed setuid sandbox is too old, installing it now." |
| + installsandbox |
| + if [ ! $? = 0 ]; then |
|
cmp
2012/06/05 22:54:20
i believe lines 48-49 can be simplified as:
if ! i
jln (very slow on Chromium)
2012/06/05 23:01:44
Done, thanks.
|
| + echo "Failed to install $chrome_sandbox_installed_path" |
| + exit 1 |
| + fi |
| +else |
| + echo "Your setuid sandbox is up to date" |
| + if [ x$CHROME_DEVEL_SANDBOX != x"$chrome_sandbox_installed_path" ]; then |
| + echo -n "Make sure you have \"export " |
| + echo -n "CHROME_DEVEL_SANDBOX=$chrome_sandbox_installed_path\" " |
| + echo "somewhere in your .bashrc" |
| + echo "This variable is currently: ${CHROME_DEVEL_SANDBOX:-"empty"}" |
| + fi |
| +fi |