2018-02-16 13:51:30 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
RM_GOPATH=0
|
|
|
|
|
|
|
|
TMP_GOPATH=${TMP_GOPATH:-""}
|
|
|
|
|
|
|
|
: ${PREFIX:="/usr/local/bin"}
|
|
|
|
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ -z "$TMP_GOPATH" ]; then
|
2018-02-16 13:51:30 -05:00
|
|
|
export GOPATH="$(mktemp -d)"
|
|
|
|
RM_GOPATH=1
|
|
|
|
else
|
|
|
|
export GOPATH="$TMP_GOPATH"
|
|
|
|
fi
|
2020-05-20 21:23:00 -04:00
|
|
|
case "$(go env GOARCH)" in
|
|
|
|
mips* | ppc64)
|
|
|
|
# pie build mode is not supported on mips architectures
|
|
|
|
export GO_BUILDMODE=""
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
export GO_BUILDMODE="-buildmode=pie"
|
|
|
|
;;
|
|
|
|
esac
|
2018-02-16 13:51:30 -05:00
|
|
|
|
|
|
|
dir="$(dirname $0)"
|
|
|
|
|
|
|
|
bin=$1
|
|
|
|
shift
|
|
|
|
|
2019-01-09 20:23:38 -05:00
|
|
|
if [ ! -f "${dir}/${bin}.installer" ]; then
|
2018-02-16 13:51:30 -05:00
|
|
|
echo "Could not find installer for \"$bin\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-09 20:50:47 -05:00
|
|
|
. ${dir}/${bin}.installer
|
|
|
|
install_${bin} "$@"
|