diff --git a/src/freedombone b/src/freedombone index 8782d85c..ba986b9a 100755 --- a/src/freedombone +++ b/src/freedombone @@ -2284,23 +2284,38 @@ function mesh_cjdns_tools { if [ ! -f ~/.bashrc ]; then touch ~/.bashrc fi - export GOPATH=$HOME/projects/go + + export GOPATH=/home/git/go + if [ ! -d /home/git ]; then + # add a gogs user account + adduser --disabled-login --gecos 'Gogs' git + + # install Go + if ! grep -q "export GOPATH=/home/git/go" ~/.bashrc; then + echo 'export GOPATH=/home/git/go' >> ~/.bashrc + echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc + fi + if [ ! -d $GOPATH ]; then + mkdir -p $GOPATH + fi + fi + if ! grep -q "export GOPATH=" ~/.bashrc; then - echo 'export GOPATH=$HOME/projects/go' >> ~/.bashrc + echo "export GOPATH=$GOPATH" >> ~/.bashrc fi - if ! grep -q "export PATH=$PATH:$HOME/projects/go/bin" ~/.bashrc; then - export PATH=$PATH:$HOME/projects/go/bin - echo 'export PATH=$PATH:$HOME/projects/go/bin' >> ~/.bashrc + expected_go_path='export PATH=$PATH:'${GOPATH}'/bin' + if ! grep -q "$expected_go_path" ~/.bashrc; then + export PATH=$PATH:${GOPATH}/bin + echo "$expected_go_path" >> ~/.bashrc fi - export GOPATH=$HOME/projects/go - export PATH=$PATH:$HOME/projects/go/bin - CJDCMD_REPO2=$(echo "$CJDCMD_REPO" | sed 's|https://||g') + export PATH=$PATH:$GOPATH/bin + CJDCMD_REPO2=$(echo "$CJDCMD_REPO" | sed 's|https://||g') go get $CJDCMD_REPO2 - if [ ! -f $HOME/projects/go/bin/cjdcmd ]; then + if [ ! -f $GOPATH/bin/cjdcmd ]; then echo $'cjdcmd was not compiled. Check your golang installation' exit 7439 fi - cp $HOME/projects/go/bin/cjdcmd /usr/bin + cp $GOPATH/bin/cjdcmd /usr/bin # initialise from the cjdns config /usr/bin/cjdcmd cjdnsadmin -file /etc/cjdns/cjdroute.conf @@ -6650,7 +6665,7 @@ function install_gogs { if [ ! -d $GOPATH ]; then mkdir -p $GOPATH fi - GO_PACKAGE_MANAGER_REPO2=$(echo "$GO_PACKAGE_MANAGER_REPO" | sed 's|https://||g') + GO_PACKAGE_MANAGER_REPO2=$(echo "$GO_PACKAGE_MANAGER_REPO" | sed 's|https://||g') go get -u $GO_PACKAGE_MANAGER_REPO2 if [ ! "$?" = "0" ]; then exit 479832 @@ -9615,7 +9630,7 @@ function install_ipfs { chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc fi - IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g') + IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g') go get -u ${IPFS_GO_REPO2}/cmd/ipfs if [ ! "$?" = "0" ]; then exit 8242