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..1ef078809d180f2c526e64a8ca548dca236f0fc1 |
--- /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"} |
+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) |
Lei Zhang
2012/06/05 23:07:05
Please double quote $chrome_sandbox_build_path her
|
+installed_api=$($chrome_sandbox_installed_path --get-api) |
+ |
+if [ x$current_api != x$installed_api ]; then |
+ echo "Your installed setuid sandbox is too old, installing it now." |
+ if ! installsandbox; then |
+ 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 |