Browse Source

Peg cjdns to a particular commit

Bob Mottram 9 years ago
parent
commit
041de6e0ad
1 changed files with 39 additions and 14 deletions
  1. 39
    14
      src/freedombone

+ 39
- 14
src/freedombone View File

393
 CJDNS_IPV6=
393
 CJDNS_IPV6=
394
 CJDNS_PASSWORD=
394
 CJDNS_PASSWORD=
395
 CJDNS_PORT=
395
 CJDNS_PORT=
396
+CJDNS_REPO="https://github.com/cjdelisle/cjdns.git"
397
+CJDNS_COMMIT='13189fde111d0500427a7a0ce06a970753527bca'
396
 
398
 
397
 # B.A.T.M.A.N settings
399
 # B.A.T.M.A.N settings
398
 ENABLE_BATMAN="no"
400
 ENABLE_BATMAN="no"
970
       if grep -q "ENABLE_CJDNS" $CONFIGURATION_FILE; then
972
       if grep -q "ENABLE_CJDNS" $CONFIGURATION_FILE; then
971
           ENABLE_CJDNS=$(grep "ENABLE_CJDNS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
973
           ENABLE_CJDNS=$(grep "ENABLE_CJDNS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
972
       fi
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
       if grep -q "CJDNS_IPV6" $CONFIGURATION_FILE; then
978
       if grep -q "CJDNS_IPV6" $CONFIGURATION_FILE; then
974
           CJDNS_IPV6=$(grep "CJDNS_IPV6" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
979
           CJDNS_IPV6=$(grep "CJDNS_IPV6" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
975
       fi
980
       fi
1403
 }
1408
 }
1404
 
1409
 
1405
 function mesh_cjdns {
1410
 function mesh_cjdns {
1406
-  if grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
1411
+  if [[ $ENABLE_CJDNS != "yes" ]]; then
1407
       return
1412
       return
1408
   fi
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
       return
1433
       return
1411
   fi
1434
   fi
1435
+
1412
   apt-get -y install nodejs git build-essential nmap
1436
   apt-get -y install nodejs git build-essential nmap
1413
 
1437
 
1414
   # if a README exists then obtain the cjdns parameters
1438
   # if a README exists then obtain the cjdns parameters
1425
   fi
1449
   fi
1426
 
1450
 
1427
   if [ ! -d /etc/cjdns ]; then
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
       cd /etc/cjdns
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
       ./do
1463
       ./do
1431
       if [ ! "$?" = "0" ]; then
1464
       if [ ! "$?" = "0" ]; then
1432
           exit 7439
1465
           exit 7439
10865
   if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
10898
   if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
10866
       return
10899
       return
10867
   fi
10900
   fi
10901
+
10902
+  apt-get -y install unattended-upgrades
10903
+
10868
   echo '#!/bin/bash' > /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10904
   echo '#!/bin/bash' > /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10869
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
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
   echo "if grep -Fxq \"install_owncloud_music_app\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10906
   echo "if grep -Fxq \"install_owncloud_music_app\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10874
   echo '  # Owncloud music app' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10907
   echo '  # Owncloud music app' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10875
   echo "  cd /usr/share/owncloud/apps/music" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10908
   echo "  cd /usr/share/owncloud/apps/music" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10878
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10911
   echo '  git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10879
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10912
   echo "fi" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10880
   echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
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
   echo "if grep -Fxq \"install_ipfs\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10914
   echo "if grep -Fxq \"install_ipfs\" $COMPLETION_FILE; then" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10890
   echo '  # ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10915
   echo '  # ipfs' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10891
   echo '  chown -R git:git /home/git' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
10916
   echo '  chown -R git:git /home/git' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME