Bob Mottram преди 9 години
родител
ревизия
95bb0d0693
променени са 1 файла, в които са добавени 27 реда и са изтрити 12 реда
  1. 27
    12
      src/freedombone

+ 27
- 12
src/freedombone Целия файл

@@ -2284,23 +2284,38 @@ function mesh_cjdns_tools {
2284 2284
     if [ ! -f ~/.bashrc ]; then
2285 2285
         touch ~/.bashrc
2286 2286
     fi
2287
-    export GOPATH=$HOME/projects/go
2287
+
2288
+    export GOPATH=/home/git/go
2289
+    if [ ! -d /home/git ]; then
2290
+        # add a gogs user account
2291
+        adduser --disabled-login --gecos 'Gogs' git
2292
+
2293
+        # install Go
2294
+        if ! grep -q "export GOPATH=/home/git/go" ~/.bashrc; then
2295
+            echo 'export GOPATH=/home/git/go' >> ~/.bashrc
2296
+            echo 'systemctl set-environment GOPATH=/home/git/go' >> ~/.bashrc
2297
+        fi
2298
+        if [ ! -d $GOPATH ]; then
2299
+            mkdir -p $GOPATH
2300
+        fi
2301
+    fi
2302
+
2288 2303
     if ! grep -q "export GOPATH=" ~/.bashrc; then
2289
-        echo 'export GOPATH=$HOME/projects/go' >> ~/.bashrc
2304
+        echo "export GOPATH=$GOPATH" >> ~/.bashrc
2290 2305
     fi
2291
-    if ! grep -q "export PATH=$PATH:$HOME/projects/go/bin" ~/.bashrc; then
2292
-        export PATH=$PATH:$HOME/projects/go/bin
2293
-        echo 'export PATH=$PATH:$HOME/projects/go/bin' >> ~/.bashrc
2306
+    expected_go_path='export PATH=$PATH:'${GOPATH}'/bin'
2307
+    if ! grep -q "$expected_go_path" ~/.bashrc; then
2308
+        export PATH=$PATH:${GOPATH}/bin
2309
+        echo "$expected_go_path" >> ~/.bashrc
2294 2310
     fi
2295
-    export GOPATH=$HOME/projects/go
2296
-    export PATH=$PATH:$HOME/projects/go/bin
2297
-	CJDCMD_REPO2=$(echo "$CJDCMD_REPO" | sed 's|https://||g')
2311
+    export PATH=$PATH:$GOPATH/bin
2312
+    CJDCMD_REPO2=$(echo "$CJDCMD_REPO" | sed 's|https://||g')
2298 2313
     go get $CJDCMD_REPO2
2299
-    if [ ! -f $HOME/projects/go/bin/cjdcmd ]; then
2314
+    if [ ! -f $GOPATH/bin/cjdcmd ]; then
2300 2315
         echo $'cjdcmd was not compiled. Check your golang installation'
2301 2316
         exit 7439
2302 2317
     fi
2303
-    cp $HOME/projects/go/bin/cjdcmd /usr/bin
2318
+    cp $GOPATH/bin/cjdcmd /usr/bin
2304 2319
 
2305 2320
     # initialise from the cjdns config
2306 2321
     /usr/bin/cjdcmd cjdnsadmin -file /etc/cjdns/cjdroute.conf
@@ -6650,7 +6665,7 @@ function install_gogs {
6650 6665
     if [ ! -d $GOPATH ]; then
6651 6666
         mkdir -p $GOPATH
6652 6667
     fi
6653
-	GO_PACKAGE_MANAGER_REPO2=$(echo "$GO_PACKAGE_MANAGER_REPO" | sed 's|https://||g')
6668
+    GO_PACKAGE_MANAGER_REPO2=$(echo "$GO_PACKAGE_MANAGER_REPO" | sed 's|https://||g')
6654 6669
     go get -u $GO_PACKAGE_MANAGER_REPO2
6655 6670
     if [ ! "$?" = "0" ]; then
6656 6671
         exit 479832
@@ -9615,7 +9630,7 @@ function install_ipfs {
9615 9630
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
9616 9631
     fi
9617 9632
 
9618
-	IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g')
9633
+    IPFS_GO_REPO2=$(echo "$IPFS_GO_REPO" | sed 's|https://||g')
9619 9634
     go get -u ${IPFS_GO_REPO2}/cmd/ipfs
9620 9635
     if [ ! "$?" = "0" ]; then
9621 9636
         exit 8242