Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: build/update-linux-sandbox.sh

Issue 10541017: Add update-linux-sandbox.sh to build/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify if statement Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698