Browse Source

Peg zeronet forum to a commit

Bob Mottram 9 years ago
parent
commit
47b1e68c8e
1 changed files with 26 additions and 0 deletions
  1. 26
    0
      src/freedombone

+ 26
- 0
src/freedombone View File

@@ -1975,6 +1975,24 @@ function install_zeronet_forum {
1975 1975
       return
1976 1976
   fi
1977 1977
 
1978
+  # update to the next commit
1979
+  if [ -d /opt/zeronet/ZeroTalk ]; then
1980
+      if grep -q "ZeroNet Forum commit" $COMPLETION_FILE; then
1981
+          CURRENT_ZERONET_FORUM_COMMIT=$(grep "ZeroNet Forum commit" $COMPLETION_FILE | awk -F ':' '{print $2}')
1982
+          if [[ "$CURRENT_ZERONET_FORUM_COMMIT" != "$ZERONET_FORUM_COMMIT" ]]; then
1983
+              cd /opt/zeronet/ZeroTalk
1984
+              git stash
1985
+              git checkout master
1986
+              git pull
1987
+              git checkout $ZERONET_FORUM_COMMIT
1988
+              git checkout -b $ZERONET_FORUM_COMMIT
1989
+              sed -i "s/ZeroNet Forum commit.*/ZeroNet Forum commit:$ZERONET_FORUM_COMMIT/g" $COMPLETION_FILE
1990
+          fi
1991
+      else
1992
+          echo "ZeroNet Forum commit:$ZERONET_FORUM_COMMIT" >> $COMPLETION_FILE
1993
+      fi
1994
+  fi
1995
+
1978 1996
   if grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
1979 1997
       return
1980 1998
   fi
@@ -2029,6 +2047,14 @@ function install_zeronet_forum {
2029 2047
       echo $'ZeroTalk repo could not be cloned'
2030 2048
       exit 6739
2031 2049
   fi
2050
+  git checkout $ZERONET_FORUM_COMMIT
2051
+  git checkout -b $ZERONET_FORUM_COMMIT
2052
+  if ! grep -q "ZeroNet Forum commit" $COMPLETION_FILE; then
2053
+      echo "ZeroNet Forum commit:$ZERONET_FORUM_COMMIT" >> $COMPLETION_FILE
2054
+  else
2055
+      sed -i "s/ZeroNet Forum commit.*/ZeroNet Forum commit:$ZERONET_FORUM_COMMIT/g" $COMPLETION_FILE
2056
+  fi
2057
+
2032 2058
   echo $"Forum address:     $ZERONET_FORUM_ADDRESS"
2033 2059
   echo $"Forum private key: $ZERONET_FORUM_PRIVATE_KEY"
2034 2060
   cp -r /opt/zeronet/ZeroTalk/* /opt/zeronet/data/$ZERONET_FORUM_ADDRESS