github.com/tardisgo/tardisgo@v0.0.0-20161119180838-e0dd9a7e46b5/goroot/haxe/go1.4/src/sudo.bash (about)

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