OLD | NEW |
1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
2 # Copyright 2009 The Go Authors. All rights reserved. | 2 # Copyright 2009 The Go Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style | 3 # Use of this source code is governed by a BSD-style |
4 # license that can be found in the LICENSE file. | 4 # license that can be found in the LICENSE file. |
5 | 5 |
6 set -e | 6 set -e |
7 | 7 |
8 case "`uname`" in | 8 case "`uname`" in |
9 Darwin) | 9 Darwin) |
10 ;; | 10 ;; |
11 *) | 11 *) |
12 exit 0 | 12 exit 0 |
13 esac | 13 esac |
14 | 14 |
| 15 eval $(go env) |
| 16 if ! [ -x $GOTOOLDIR/cov -a -x $GOTOOLDIR/prof ]; then |
| 17 echo "You don't need to run sudo.bash." >&2 |
| 18 exit 2 |
| 19 fi |
| 20 |
15 if [[ ! -d /usr/local/bin ]]; then | 21 if [[ ! -d /usr/local/bin ]]; then |
16 echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.
' | 22 echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.
' |
17 exit 2 | 23 exit 2 |
18 fi | 24 fi |
19 | 25 |
20 eval $(go env) | |
21 cd $(dirname $0) | 26 cd $(dirname $0) |
22 for i in prof cov | 27 for i in prof cov |
23 do | 28 do |
24 # Remove old binaries if present | 29 # Remove old binaries if present |
25 sudo rm -f /usr/local/bin/6$i | 30 sudo rm -f /usr/local/bin/6$i |
26 # Install new binaries | 31 # Install new binaries |
27 sudo cp $GOTOOLDIR/$i /usr/local/bin/go$i | 32 sudo cp $GOTOOLDIR/$i /usr/local/bin/go$i |
28 sudo chgrp procmod /usr/local/bin/go$i | 33 sudo chgrp procmod /usr/local/bin/go$i |
29 sudo chmod g+s /usr/local/bin/go$i | 34 sudo chmod g+s /usr/local/bin/go$i |
30 done | 35 done |
OLD | NEW |