Kaynağa Gözat

Peg ipfs to a specific commit

Bob Mottram 9 yıl önce
ebeveyn
işleme
147e8fff23
1 değiştirilmiş dosya ile 37 ekleme ve 10 silme
  1. 37
    10
      src/freedombone

+ 37
- 10
src/freedombone Dosyayı Görüntüle

@@ -432,6 +432,9 @@ TRACKER_PORT=6969
432 432
 ZERONET_DEFAULT_BLOG_TAGLINE="Blogging on the Mesh"
433 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 438
 IPFS_PORT=4001
436 439
 
437 440
 # Default diffie-hellman key length in bits
@@ -823,6 +826,9 @@ function read_configuration {
823 826
       if grep -q "HUBZILLA_COMMIT" $CONFIGURATION_FILE; then
824 827
           HUBZILLA_COMMIT=$(grep "HUBZILLA_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
825 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 832
       if grep -q "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE; then
827 833
           GNUSOCIAL_COMMIT=$(grep "GNUSOCIAL_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
828 834
       fi
@@ -10979,15 +10985,6 @@ function create_upgrade_script {
10979 10985
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10980 10986
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10981 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 10988
   echo '# update email encryption script' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10992 10989
   echo "if [ -d $INSTALL_DIR/gpgit ]; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10993 10990
   echo "  cd $INSTALL_DIR/gpgit" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
@@ -11315,9 +11312,30 @@ function install_ipfs {
11315 11312
   if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" ]]; then
11316 11313
       return
11317 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 11335
   if grep -Fxq "install_ipfs" $COMPLETION_FILE; then
11319 11336
       return
11320 11337
   fi
11338
+
11321 11339
   apt-get -y install golang libpam0g-dev fuse
11322 11340
 
11323 11341
   if [ ! -d /home/git ]; then
@@ -11349,11 +11367,20 @@ function install_ipfs {
11349 11367
       chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.bashrc
11350 11368
   fi
11351 11369
 
11352
-  go get -u github.com/ipfs/go-ipfs/cmd/ipfs
11370
+  go get -u $IPFS_GO_REPO
11353 11371
   if [ ! "$?" = "0" ]; then
11354 11372
       exit 8242
11355 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 11384
   # initialise
11358 11385
   su -c "$IPFS_PATH/ipfs init -b 4096" - $MY_USERNAME
11359 11386
   if [ ! -d /home/$MY_USERNAME/.ipfs ]; then