From cb3266d82ff827a8972cdaf4f216e69c8b76041b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Aug 2016 07:56:52 +0100 Subject: [PATCH] Check that directory exists --- src/freedombone-app-ipfs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index 60b4eb8e..ecf88245 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -408,18 +408,10 @@ fi IPFS_PATH=\$GOPATH/bin export PATH="\$GOPATH/bin:\$PATH:" -if ! grep -q 'GOPATH/bin' ~/.bashrc; then - echo 'export PATH="\$GOPATH/bin:\$PATH:";' >> ~/.bashrc -else - sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=\$GOPATH|g" ~/.bashrc -fi +echo 'export PATH="\$GOPATH/bin:\$PATH:";' >> /home/$MY_USERNAME/.bashrc -# set gopath for the user -if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then - echo "export GOPATH=$GOPATH" >> /home/$MY_USERNAME/.bashrc - echo 'export PATH="\$GOPATH/bin:\$PATH:";' >> /home/$MY_USERNAME/.bashrc -else - sed -i "s|export GOPATH=.*|export GOPATH=\$GOPATH|g" /home/$MY_USERNAME/.bashrc +if grep -q 'GOPATH/bin' ~/.bashrc; then + sed -i "s|systemctl set-environment GOPATH=.*|systemctl set-environment GOPATH=\$GOPATH|g" ~/.bashrc fi chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc @@ -429,6 +421,11 @@ if [ ! "$?" = "0" ]; then exit 8242 fi +if [ ! -d $GOPATH/src/$IPFS_GO_REPO2 ]; then + echo $'go get failed to get ipfs' + exit 63923 +fi + cd \$GOPATH/src/$IPFS_GO_REPO2 git checkout $IPFS_COMMIT -b $IPFS_COMMIT exit 0 @@ -521,6 +518,11 @@ function install_ipfs_go { exit 8242 fi + if [ ! -d $GOPATH/src/$IPFS_GO_REPO2 ]; then + echo $'go get failed to get ipfs' + exit 63923 + fi + cd $GOPATH/src/$IPFS_GO_REPO2 git checkout $IPFS_COMMIT -b $IPFS_COMMIT if ! grep -q "ipfs commit" $COMPLETION_FILE; then