From 40f8d114a587484469dca556ae34c72ce230d58d Mon Sep 17 00:00:00 2001 From: rootzoll Date: Wed, 18 Dec 2019 20:26:47 +0100 Subject: [PATCH] prevent double entry --- home.admin/config.scripts/bonus.go.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/home.admin/config.scripts/bonus.go.sh b/home.admin/config.scripts/bonus.go.sh index 4265f82c7..258144baa 100755 --- a/home.admin/config.scripts/bonus.go.sh +++ b/home.admin/config.scripts/bonus.go.sh @@ -48,11 +48,13 @@ if [ ${goInstalled} -eq 0 ];then export PATH=$PATH:$GOROOT/bin export GOPATH=/usr/local/gocode export PATH=$PATH:$GOPATH/bin - sudo bash -c "echo 'GOROOT=/usr/local/go' >> /etc/profile" - sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin/' >> /etc/profile" - sudo bash -c "echo 'GOPATH=/usr/local/gocode' >> /etc/profile" - sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/bin/' >> /etc/profile" - + if [ $(cat /etc/profile | grep -c "GOROOT=") -eq 0 ]; then + sudo bash -c "echo 'GOROOT=/usr/local/go' >> /etc/profile" + sudo bash -c "echo 'PATH=\$PATH:\$GOROOT/bin/' >> /etc/profile" + sudo bash -c "echo 'GOPATH=/usr/local/gocode' >> /etc/profile" + sudo bash -c "echo 'PATH=\$PATH:\$GOPATH/bin/' >> /etc/profile" + fi + # set GOPATH https://github.com/golang/go/wiki/SettingGOPATH go env -w GOPATH=/usr/local/gocode