2018-02-16 18:51:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
RM_GOPATH=0
|
|
|
|
|
|
|
|
TMP_GOPATH=${TMP_GOPATH:-""}
|
|
|
|
|
|
|
|
: ${PREFIX:="/usr/local/bin"}
|
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ -z "$TMP_GOPATH" ]; then
|
2018-02-16 18:51:30 +00:00
|
|
|
export GOPATH="$(mktemp -d)"
|
|
|
|
RM_GOPATH=1
|
|
|
|
else
|
|
|
|
export GOPATH="$TMP_GOPATH"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dir="$(dirname $0)"
|
|
|
|
|
|
|
|
bin=$1
|
|
|
|
shift
|
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ ! -f "${dir}/${bin}.installer" ]; then
|
2018-02-16 18:51:30 +00:00
|
|
|
echo "Could not find installer for \"$bin\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
. $dir/$bin.installer
|
|
|
|
install_$bin "$@"
|