diff --git a/build-go.sh b/build-go.sh index 6834738..e2b6522 100755 --- a/build-go.sh +++ b/build-go.sh @@ -1,6 +1,10 @@ #!/bin/bash set -e +if [ ${EUID} -ne 0 ]; then + echo "error: this script must be run as root" 1>&2 + exit 1 +fi GITHUB="https://github.com/golang/go/archive/" @@ -31,6 +35,12 @@ cd ${INSTALL}/${V14}/src export GOROOT_BOOTSTRAP=${INSTALL}/${V14} +if [ "$(uname -m)" == "x86_64" ]; then + export GOARCH=386 +else + export GOARCH=amd64 +fi + cd ${INSTALL}/${Vnew}/src ./make.bash &> /dev/null @@ -45,6 +55,7 @@ echo "add this to your .bashrc/.profile:" echo "" echo "export CGO_ENABLED=0" echo "export GOPATH=~/go" +echo "export GOROOT=/usr/local/go" echo "export PATH=\${PATH}:${GOROOT}" echo ""