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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/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
2 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
3 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
4 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
5 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
6 # 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
7 chrome_sandbox_installed_path="${CHROME_OUT_DIR}/installed_chrome_sandbox"
8
9 if [ ! -d "$CHROME_OUT_DIR" ]
Markus (顧孟勤) 2012/06/05 23:17:57 You don't technically need curly braces around thi
10 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
11 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
12 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
13 exit 1
14 fi
15
16 if [ ! -f "$chrome_sandbox_build_path" ]
Markus (顧孟勤) 2012/06/05 23:17:57 See above
17 then
18 echo -n "Could not find $chrome_sandbox_build_path, "
Markus (顧孟勤) 2012/06/05 23:17:57 See above
19 echo "please make sure you build the chrome_sandbox target"
20 exit 1
21 fi
22
23 installsandbox() {
Markus (顧孟勤) 2012/06/05 23:17:57 How come, this is a function. But nothing else in
24 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
25 sudo -- chown root:root $chrome_sandbox_installed_path &&
26 sudo -- chmod 4755 $chrome_sandbox_installed_path
27 return $?
28 }
29
30 if [ ! -f "$chrome_sandbox_installed_path" ]
Markus (顧孟勤) 2012/06/05 23:17:57 See above
31 then
32 echo -n "Could not find $chrome_sandbox_installed_path, "
Markus (顧孟勤) 2012/06/05 23:17:57 See above
33 echo "installing it now."
34 installsandbox
35 fi
36
37 if [ ! -f "$chrome_sandbox_installed_path" ]
Markus (顧孟勤) 2012/06/05 23:17:57 See above
38 then
39 echo "Failed to install $chrome_sandbox_installed_path"
Markus (顧孟勤) 2012/06/05 23:17:57 See above
40 exit 1
41 fi
42
43 current_api=$($chrome_sandbox_build_path --get-api)
Markus (顧孟勤) 2012/06/05 23:17:57 current_api="$("${chrome_sandbox_build_path}" --ge
44 installed_api=$($chrome_sandbox_installed_path --get-api)
Markus (顧孟勤) 2012/06/05 23:17:57 See above
45
46 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
47 then
48 echo -n "Your installed setuid sandbox is too old, "
49 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.
50 installsandbox
51 if [ ! $? = 0 ]
Markus (顧孟勤) 2012/06/05 23:17:57 If comparing numbers, use the appropriate operator
52 then
53 echo "Failed to install $chrome_sandbox_installed_path"
Markus (顧孟勤) 2012/06/05 23:17:57 See above
54 exit 1
55 fi
56 else
57 echo "Your setuid sandbox is up to date"
58 if [ ! x$CHROME_DEVEL_SANDBOX = x"$chrome_sandbox_installed_path" ]
Markus (顧孟勤) 2012/06/05 23:17:57 See above
59 then
60 echo -n "Make sure you have \"export "
61 echo -n "CHROME_DEVEL_SANDBOX=$chrome_sandbox_installed_path\" "
Markus (顧孟勤) 2012/06/05 23:17:57 See above
62 echo "somewhere in your .bashrc"
63 echo "This variable is currently: ${CHROME_DEVEL_SANDBOX:-"empty"}"
Markus (顧孟勤) 2012/06/05 23:17:57 You don't need quotes around "empty"
64 fi
65 fi
OLDNEW
« 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