Bob Mottram 9 years ago
parent
commit
12b4b929ea
1 changed files with 9 additions and 6 deletions
  1. 9
    6
      src/freedombone

+ 9
- 6
src/freedombone View File

@@ -10336,9 +10336,11 @@ function install_ipfs {
10336 10336
       fi
10337 10337
   fi
10338 10338
 
10339
+  IPFS_PATH=/home/git/go/src/github.com/ipfs/go-ipfs/cmd
10339 10340
   if ! grep -q 'GOPATH/bin' ~/.bashrc; then
10340 10341
       echo 'export PATH="$GOPATH/bin:$PATH:";' >> ~/.bashrc
10341
-      echo 'export PATH="$PATH:$GOPATH/src/github.com/ipfs/go-ipfs/cmd";' >> ~/.bashrc
10342
+      echo -n 'export PATH="$PATH:' >> ~/.bashrc
10343
+      echo "$IPFS_PATH\";" >> ~/.bashrc
10342 10344
   fi
10343 10345
   . ~/.bashrc
10344 10346
 
@@ -10346,7 +10348,8 @@ function install_ipfs {
10346 10348
   if ! grep -q "GOPATH=" /home/$MY_USERNAME/.bashrc; then
10347 10349
       echo 'export GOPATH=/home/git/go' >> /home/$MY_USERNAME/.bashrc
10348 10350
       echo 'export PATH="$GOPATH/bin:$PATH:";' >> /home/$MY_USERNAME/.bashrc
10349
-      echo 'export PATH="$PATH:$GOPATH/src/github.com/ipfs/go-ipfs/cmd";' >> /home/$MY_USERNAME/.bashrc
10351
+      echo 'export PATH="$PATH:' >> /home/$MY_USERNAME/.bashrc
10352
+      echo "$IPFS_PATH\";" >> /home/$MY_USERNAME/.bashrc
10350 10353
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
10351 10354
   fi
10352 10355
 
@@ -10356,13 +10359,13 @@ function install_ipfs {
10356 10359
   fi
10357 10360
 
10358 10361
   # initialise
10359
-  su -c 'ipfs init -b 4096' - $MY_USERNAME
10362
+  su -c "$IPFS_PATH/ipfs init -b 4096" - $MY_USERNAME
10360 10363
   if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
10361 10364
       echo "IPFS could not be initialised for user $MY_USERNAME"
10362 10365
       exit 7358
10363 10366
   fi
10364 10367
 
10365
-  IPFS_IDENTITY=$(ipfs refs local | tail -n 1 | tr '\n' ' ' | tr -d '[[:space:]]')
10368
+  IPFS_IDENTITY=$($IPFS_PATH/ipfs refs local | tail -n 1 | tr '\n' ' ' | tr -d '[[:space:]]')
10366 10369
   if [ ${#IPFS_IDENTITY} -lt 10 ]; then
10367 10370
       echo 'IPFS identity shorter than expected'
10368 10371
       echo "$IPFS_IDENTITY"
@@ -10397,8 +10400,8 @@ function install_ipfs {
10397 10400
   echo 'Type=simple' >> /etc/systemd/system/ipfs.service
10398 10401
   echo 'User=git' >> /etc/systemd/system/ipfs.service
10399 10402
   echo 'Group=git' >> /etc/systemd/system/ipfs.service
10400
-  echo 'WorkingDirectory=/home/git/go/src/github.com/ipfs/go-ipfs/cmd' >> /etc/systemd/system/ipfs.service
10401
-  echo 'ExecStart=/home/git/go/src/github.com/ipfs/go-ipfs/cmd/ipfs daemon --mount' >> /etc/systemd/system/ipfs.service
10403
+  echo 'WorkingDirectory=/home/git' >> /etc/systemd/system/ipfs.service
10404
+  echo "ExecStart=$IPFS_PATH/ipfs daemon --mount" >> /etc/systemd/system/ipfs.service
10402 10405
   echo 'Restart=on-failure' >> /etc/systemd/system/ipfs.service
10403 10406
   echo 'Environment="USER=git" "HOME=/home/git" "GOPATH=/home/git/go"' >> /etc/systemd/system/ipfs.service
10404 10407
   echo '' >> /etc/systemd/system/ipfs.service