Browse Source

Peg ipfs to a specific commit

Bob Mottram 9 years ago
parent
commit
147e8fff23
1 changed files with 37 additions and 10 deletions
  1. 37
    10
      src/freedombone

+ 37
- 10
src/freedombone View File

432
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
432
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
433
 ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
433
 ZERONET_DEFAULT_FORUM_TAGLINE="A decentralized discussion group"
434
 
434
 
435
+# https://github.com/ipfs/go-ipfs
436
+IPFS_GO_REPO="github.com/ipfs/go-ipfs/cmd/ipfs"
437
+IPFS_COMMIT='20b06a4cbce8884f5b194da6e98cb11f2c77f166'
435
 IPFS_PORT=4001
438
 IPFS_PORT=4001
436
 
439
 
437
 # Default diffie-hellman key length in bits
440
 # Default diffie-hellman key length in bits
823
       if grep -q "HUBZILLA_COMMIT" $CONFIGURATION_FILE; then
826
       if grep -q "HUBZILLA_COMMIT" $CONFIGURATION_FILE; then
824
           HUBZILLA_COMMIT=$(grep "HUBZILLA_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
827
           HUBZILLA_COMMIT=$(grep "HUBZILLA_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
825
       fi
828
       fi
829
+      if grep -q "IPFS_COMMIT" $CONFIGURATION_FILE; then
830
+          IPFS_COMMIT=$(grep "IPFS_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
831
+      fi
826
       if grep -q "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE; then
832
       if grep -q "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE; then
827
           GNUSOCIAL_COMMIT=$(grep "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
833
           GNUSOCIAL_COMMIT=$(grep "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
828
       fi
834
       fi
10979
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10985
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10980
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10986
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10981
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10987
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10982
-  echo "if grep -Fxq \"install_ipfs\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10983
-  echo '  # ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10984
-  echo '  chown -R git:git /home/git' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10985
-  echo '  export GOPATH=/home/git/go' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10986
-  echo '  go get -u github.com/ipfs/go-ipfs/cmd/ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10987
-  echo '  systemctl restart ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10988
-  echo '  systemctl daemon-reload' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10989
-  echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10990
-  echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10991
   echo '# update email encryption script' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10988
   echo '# update email encryption script' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10992
   echo "if [ -d $INSTALL_DIR/gpgit ]; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10989
   echo "if [ -d $INSTALL_DIR/gpgit ]; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10993
   echo "  cd $INSTALL_DIR/gpgit" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10990
   echo "  cd $INSTALL_DIR/gpgit" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
11315
   if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" ]]; then
11312
   if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" ]]; then
11316
       return
11313
       return
11317
   fi
11314
   fi
11315
+
11316
+  # update to the next commit
11317
+  if [ -d /home/git/go/src/github.com/ipfs/go-ipfs ]; then
11318
+      if grep -q "ipfs commit" $COMPLETION_FILE; then
11319
+          CURRENT_IPFS_COMMIT=$(grep "ipfs commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
11320
+          if [[ "$CURRENT_IPFS_COMMIT" != "$IPFS_COMMIT" ]]; then
11321
+              cd /home/git/go/src/github.com/ipfs/go-ipfs
11322
+              git stash
11323
+              git checkout master
11324
+              git pull
11325
+              git checkout $IPFS_COMMIT
11326
+              git branch -b $IPFS_COMMIT
11327
+              sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE
11328
+              chown -R git:git /home/git
11329
+              systemctl restart ipfs
11330
+              systemctl daemon-reload
11331
+          fi
11332
+      fi
11333
+  fi
11334
+
11318
   if grep -Fxq "install_ipfs" $COMPLETION_FILE; then
11335
   if grep -Fxq "install_ipfs" $COMPLETION_FILE; then
11319
       return
11336
       return
11320
   fi
11337
   fi
11338
+
11321
   apt-get -y install golang libpam0g-dev fuse
11339
   apt-get -y install golang libpam0g-dev fuse
11322
 
11340
 
11323
   if [ ! -d /home/git ]; then
11341
   if [ ! -d /home/git ]; then
11349
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
11367
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
11350
   fi
11368
   fi
11351
 
11369
 
11352
-  go get -u github.com/ipfs/go-ipfs/cmd/ipfs
11370
+  go get -u $IPFS_GO_REPO
11353
   if [ ! "$?" = "0" ]; then
11371
   if [ ! "$?" = "0" ]; then
11354
       exit 8242
11372
       exit 8242
11355
   fi
11373
   fi
11356
 
11374
 
11375
+  cd /home/git/go/src/github.com/ipfs/go-ipfs
11376
+  git checkout $IPFS_COMMIT
11377
+  git branch -b $IPFS_COMMIT
11378
+  if ! grep -q "ipfs commit" $COMPLETION_FILE; then
11379
+      echo "ipfs commit:$IPFS_COMMIT" >> $COMPLETION_FILE
11380
+  else
11381
+      sed -i "s/ipfs commit.*/ipfs commit:$IPFS_COMMIT/g" $COMPLETION_FILE
11382
+  fi
11383
+
11357
   # initialise
11384
   # initialise
11358
   su -c "$IPFS_PATH/ipfs init -b 4096" - $MY_USERNAME
11385
   su -c "$IPFS_PATH/ipfs init -b 4096" - $MY_USERNAME
11359
   if [ ! -d /home/$MY_USERNAME/.ipfs ]; then
11386
   if [ ! -d /home/$MY_USERNAME/.ipfs ]; then