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..ff0795acb95141ea5b5c0a1fd960fe9c580ea23b |
--- /dev/null |
+++ b/build/update-linux-sandbox.sh |
@@ -0,0 +1,65 @@ |
+#!/bin/sh |
cmp
2012/06/05 22:11:29
add -e
add standard Chromium copyright header
jln (very slow on Chromium)
2012/06/05 22:43:08
I specifically didn't do it because I wanted to gi
Markus (顧孟勤)
2012/06/05 23:17:57
/bin/sh is OK and it results in slightly faster ex
Markus (顧孟勤)
2012/06/05 23:21:58
You can still do explicit error handling, even whe
|
+BUILDTYPE=${BUILDTYPE:-"Debug"} |
cmp
2012/06/05 22:11:29
insert a blank line before line 2
jln (very slow on Chromium)
2012/06/05 22:43:08
Done.
Markus (顧孟勤)
2012/06/05 23:17:57
You don't really need the quotes around the string
|
+CHROME_SRC_DIR=${CHROME_SRC_DIR:-$(dirname $(readlink -fn $0))/..} |
Markus (顧孟勤)
2012/06/05 23:17:57
There are a whole bunch of variable expansions her
|
+CHROME_OUT_DIR="${CHROME_SRC_DIR}/out/${BUILDTYPE}" |
Lei Zhang
2012/06/05 22:07:45
Have you considered putting the dev sandbox at say
jln (very slow on Chromium)
2012/06/05 22:43:08
Done.
I was wondering if having a global one coul
Lei Zhang
2012/06/05 23:03:18
I think most people would want to run this once an
|
+chrome_sandbox_build_path="${CHROME_OUT_DIR}/chrome_sandbox" |
Markus (顧孟勤)
2012/06/05 23:17:57
Any reason for you to use lower-case variables her
|
+# Make sure the path below is not on NFS! |
Markus (顧孟勤)
2012/06/05 23:17:57
This comment doesn't seem to reflect what the code
|
+chrome_sandbox_installed_path="${CHROME_OUT_DIR}/installed_chrome_sandbox" |
+ |
+if [ ! -d "$CHROME_OUT_DIR" ] |
Markus (顧孟勤)
2012/06/05 23:17:57
You don't technically need curly braces around thi
|
+then |
cmp
2012/06/05 22:11:29
please use this syntax:
if [ ... ];
then
Lei Zhang
2012/06/05 22:13:27
Did you mean "if [ ... ]; then" ?
cmp
2012/06/05 22:32:32
I'm retracting this comment since the scripts in s
|
+ echo -n "$CHROME_OUT_DIR does not exist. Use \"BUILDTYPE=Release ${0}\" " |
Markus (顧孟勤)
2012/06/05 23:17:57
Again, missing curly braces. And we are missing an
|
+ echo "If you are building in Release mode" |
Markus (顧孟勤)
2012/06/05 23:17:57
This is likely going to result in a line that is l
|
+ exit 1 |
+fi |
+ |
+if [ ! -f "$chrome_sandbox_build_path" ] |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+then |
+ echo -n "Could not find $chrome_sandbox_build_path, " |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ echo "please make sure you build the chrome_sandbox target" |
+ exit 1 |
+fi |
+ |
+installsandbox() { |
Markus (顧孟勤)
2012/06/05 23:17:57
How come, this is a function. But nothing else in
|
+ sudo -- cp $chrome_sandbox_build_path $chrome_sandbox_installed_path && |
Lei Zhang
2012/06/05 22:07:45
nit: put variable in double quotes here and below.
jln (very slow on Chromium)
2012/06/05 22:43:08
Done.
Markus (顧孟勤)
2012/06/05 23:17:57
We really need quotes. Bad things will otherwise h
Markus (顧孟勤)
2012/06/05 23:21:58
You might want to warn users that you are about to
|
+ sudo -- chown root:root $chrome_sandbox_installed_path && |
+ sudo -- chmod 4755 $chrome_sandbox_installed_path |
+ return $? |
+} |
+ |
+if [ ! -f "$chrome_sandbox_installed_path" ] |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+then |
+ echo -n "Could not find $chrome_sandbox_installed_path, " |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ echo "installing it now." |
+ installsandbox |
+fi |
+ |
+if [ ! -f "$chrome_sandbox_installed_path" ] |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+then |
+ echo "Failed to install $chrome_sandbox_installed_path" |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ exit 1 |
+fi |
+ |
+current_api=$($chrome_sandbox_build_path --get-api) |
Markus (顧孟勤)
2012/06/05 23:17:57
current_api="$("${chrome_sandbox_build_path}" --ge
|
+installed_api=$($chrome_sandbox_installed_path --get-api) |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ |
+if [ ! x$current_api = x$installed_api ] |
Lei Zhang
2012/06/05 22:07:45
nit: You can do: if [ "$foo" != "$bar" ]
Same belo
jln (very slow on Chromium)
2012/06/05 22:43:08
Done.
Markus (顧孟勤)
2012/06/05 23:17:57
I think, "bash" is actually smart enough to not ne
|
+then |
+ echo -n "Your installed setuid sandbox is too old, " |
+ echo "installing it now." |
Lei Zhang
2012/06/05 22:07:45
nit: this fits on the previous line.
jln (very slow on Chromium)
2012/06/05 22:43:08
Done.
|
+ installsandbox |
+ if [ ! $? = 0 ] |
Markus (顧孟勤)
2012/06/05 23:17:57
If comparing numbers, use the appropriate operator
|
+ then |
+ echo "Failed to install $chrome_sandbox_installed_path" |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ exit 1 |
+ fi |
+else |
+ echo "Your setuid sandbox is up to date" |
+ if [ ! x$CHROME_DEVEL_SANDBOX = x"$chrome_sandbox_installed_path" ] |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ then |
+ echo -n "Make sure you have \"export " |
+ echo -n "CHROME_DEVEL_SANDBOX=$chrome_sandbox_installed_path\" " |
Markus (顧孟勤)
2012/06/05 23:17:57
See above
|
+ echo "somewhere in your .bashrc" |
+ echo "This variable is currently: ${CHROME_DEVEL_SANDBOX:-"empty"}" |
Markus (顧孟勤)
2012/06/05 23:17:57
You don't need quotes around "empty"
|
+ fi |
+fi |