2009-11-14 16:29:09 -07:00
|
|
|
#!/usr/bin/env bash
|
2008-11-18 11:08:46 -07:00
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2010-08-18 08:08:49 -06:00
|
|
|
set -e
|
|
|
|
|
2008-11-18 11:08:46 -07:00
|
|
|
case "`uname`" in
|
|
|
|
Darwin)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
esac
|
|
|
|
|
2012-11-15 11:42:39 -07:00
|
|
|
# Check that the go command exists
|
|
|
|
if ! go help >/dev/null 2>&1; then
|
|
|
|
echo "The go command is not in your PATH." >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2012-04-02 08:33:38 -06:00
|
|
|
eval $(go env)
|
2013-05-24 12:06:06 -06:00
|
|
|
if ! [ -x $GOTOOLDIR/prof ]; then
|
2012-04-02 08:33:38 -06:00
|
|
|
echo "You don't need to run sudo.bash." >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2011-09-01 01:24:32 -06:00
|
|
|
if [[ ! -d /usr/local/bin ]]; then
|
|
|
|
echo 1>&2 'sudo.bash: problem with /usr/local/bin; cannot install tools.'
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2012-02-04 20:50:38 -07:00
|
|
|
cd $(dirname $0)
|
2013-05-24 12:06:06 -06:00
|
|
|
for i in prof
|
2008-11-18 11:08:46 -07:00
|
|
|
do
|
2012-01-29 11:14:36 -07:00
|
|
|
# Remove old binaries if present
|
|
|
|
sudo rm -f /usr/local/bin/6$i
|
|
|
|
# Install new binaries
|
2012-02-14 14:42:16 -07:00
|
|
|
sudo cp $GOTOOLDIR/$i /usr/local/bin/go$i
|
2012-01-29 11:14:36 -07:00
|
|
|
sudo chgrp procmod /usr/local/bin/go$i
|
|
|
|
sudo chmod g+s /usr/local/bin/go$i
|
2008-11-18 11:08:46 -07:00
|
|
|
done
|