diff options
author | Sean E. Russell <ser@ser1.net> | 2020-06-18 16:46:56 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-06-18 16:46:56 -0500 |
commit | b29c2b1c89b9eb64f08ae005853d5e8047bdd432 (patch) | |
tree | 60b761f4f65c9c7ebb1fdf079038087cd0c20849 /scripts/install_without_root.sh | |
parent | 444d2624ab6d5b054446a08ad6888126f9d3494c (diff) | |
parent | e2879e970c09d01422d6bc259d2601572679f745 (diff) |
Merge branch 'master' into i18n
Diffstat (limited to 'scripts/install_without_root.sh')
-rwxr-xr-x | scripts/install_without_root.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/install_without_root.sh b/scripts/install_without_root.sh new file mode 100755 index 0000000..9bdf839 --- /dev/null +++ b/scripts/install_without_root.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Builds the gotop executable on machines where Go isn't installed, +# or is the wrong version, and you don't have root access to upgrade or +# install Go. +# +# You can run this without cloning the entire gotop repository (the script +# will do this for you.) + +set -x + +VERSION='1.14.2' # Go version needed to build +OS='linux' +ARCH='amd64' +BUILDDIR=/tmp/gotop-build +INSTALLDIR=${HOME}/bin + +GO_NAME=go${VERSION}.${OS}-${ARCH} + +mkdir -p $BUILDDIR +cd $BUILDDIR + +curl https://dl.google.com/go/${GO_NAME}.tar.gz --output ./${GO_NAME}.tar.gz + +tar -vxzf ${GO_NAME}.tar.gz +rm ${GO_NAME}.tar.gz + +PATH=$BUILDDIR/go/bin:$PATH + +go env -w GOPATH=$BUILDDIR # otherwise go would create a directory in $HOME + +rm -rf ./gotop +git clone https://github.com/xxxserxxx/gotop.git +cd ./gotop +go build -o gotop ./cmd/gotop + +go clean -modcache # otherwise $BUILDDIR/pkg would need sudo permissions to remove + +mkdir -p $INSTALLDIR +mv gotop ${INSTALLDIR}/gotop + +rm -rf $BUILDDIR + +printf "gotop installed in ${INSTALLDIR}/gotop\n" + |