浏览代码

Peg cjdns to a particular commit

Bob Mottram 9 年前
父节点
当前提交
041de6e0ad
共有 1 个文件被更改,包括 39 次插入14 次删除
  1. 39
    14
      src/freedombone

+ 39
- 14
src/freedombone 查看文件

@@ -393,6 +393,8 @@ CJDNS_PUBLIC_KEY=
393 393
 CJDNS_IPV6=
394 394
 CJDNS_PASSWORD=
395 395
 CJDNS_PORT=
396
+CJDNS_REPO="https://github.com/cjdelisle/cjdns.git"
397
+CJDNS_COMMIT='13189fde111d0500427a7a0ce06a970753527bca'
396 398
 
397 399
 # B.A.T.M.A.N settings
398 400
 ENABLE_BATMAN="no"
@@ -970,6 +972,9 @@ function read_configuration {
970 972
       if grep -q "ENABLE_CJDNS" $CONFIGURATION_FILE; then
971 973
           ENABLE_CJDNS=$(grep "ENABLE_CJDNS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
972 974
       fi
975
+      if grep -q "CJDNS_COMMIT" $CONFIGURATION_FILE; then
976
+          CJDNS_COMMIT=$(grep "CJDNS_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
977
+      fi
973 978
       if grep -q "CJDNS_IPV6" $CONFIGURATION_FILE; then
974 979
           CJDNS_IPV6=$(grep "CJDNS_IPV6" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
975 980
       fi
@@ -1403,12 +1408,31 @@ function enable_ipv6 {
1403 1408
 }
1404 1409
 
1405 1410
 function mesh_cjdns {
1406
-  if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
1411
+  if [[ $ENABLE_CJDNS != "yes" ]]; then
1407 1412
       return
1408 1413
   fi
1409
-  if [[ $ENABLE_CJDNS != "yes" ]]; then
1414
+
1415
+  # update to the next commit
1416
+  if [ -d /etc/cjdns ]; then
1417
+      if grep -q "cjdns commit" $COMPLETION_FILE; then
1418
+          CURRENT_CJDNS_COMMIT=$(grep "cjdns commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
1419
+          if [[ "$CURRENT_CJDNS_COMMIT" != "$CJDNS_COMMIT" ]]; then
1420
+              cd /etc/cjdns
1421
+              git stash
1422
+              git checkout master
1423
+              git pull
1424
+              git checkout $CJDNS_COMMIT
1425
+              git branch -b $CJDNS_COMMIT
1426
+              sed -i "s/cjdns commit.*/cjdns commit:$CJDNS_COMMIT/g" $COMPLETION_FILE
1427
+              ./do
1428
+          fi
1429
+      fi
1430
+  fi
1431
+
1432
+  if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
1410 1433
       return
1411 1434
   fi
1435
+
1412 1436
   apt-get -y install nodejs git build-essential nmap
1413 1437
 
1414 1438
   # if a README exists then obtain the cjdns parameters
@@ -1425,8 +1449,17 @@ function mesh_cjdns {
1425 1449
   fi
1426 1450
 
1427 1451
   if [ ! -d /etc/cjdns ]; then
1428
-      git clone https://github.com/cjdelisle/cjdns.git /etc/cjdns
1452
+      git clone $CJDNS_REPO /etc/cjdns
1429 1453
       cd /etc/cjdns
1454
+
1455
+      git checkout $CJDNS_COMMIT
1456
+      git branch -b $CJDNS_COMMIT
1457
+      if ! grep -q "cjdns commit" $COMPLETION_FILE; then
1458
+          echo "cjdns commit:$CJDNS_COMMIT" >> $COMPLETION_FILE
1459
+      else
1460
+          sed -i "s/cjdns commit.*/cjdns commit:$CJDNS_COMMIT/g" $COMPLETION_FILE
1461
+      fi
1462
+
1430 1463
       ./do
1431 1464
       if [ ! "$?" = "0" ]; then
1432 1465
           exit 7439
@@ -10865,11 +10898,11 @@ function create_upgrade_script {
10865 10898
   if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
10866 10899
       return
10867 10900
   fi
10901
+
10902
+  apt-get -y install unattended-upgrades
10903
+
10868 10904
   echo '#!/bin/bash' > /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10869 10905
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10870
-  echo 'apt-get -y update' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10871
-  echo 'apt-get -y upgrade' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10872
-  echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10873 10906
   echo "if grep -Fxq \"install_owncloud_music_app\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10874 10907
   echo '  # Owncloud music app' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10875 10908
   echo "  cd /usr/share/owncloud/apps/music" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
@@ -10878,14 +10911,6 @@ function create_upgrade_script {
10878 10911
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10879 10912
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10880 10913
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10881
-  echo "if grep -Fxq \"mesh_cjdns\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10882
-  echo '  # cjdns' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10883
-  echo "  cd /etc/cjdns" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10884
-  echo '  git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10885
-  echo '  git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10886
-  echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10887
-  echo 'fi' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10888
-  echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10889 10914
   echo "if grep -Fxq \"install_ipfs\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10890 10915
   echo '  # ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10891 10916
   echo '  chown -R git:git /home/git' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME