taler-mailbox

Service for asynchronous wallet-to-wallet payment messages
Log | Files | Refs | Submodules | README | LICENSE

gana_update.sh (1523B)


      1 # This is more portable than `which' but comes with
      2 # the caveat of not(?) properly working on busybox's ash:
      3 MAILBOX_SRC_ROOT=$PWD
      4 if [ ! -f $MAILBOX_SRC_ROOT/contrib/gana_update.sh ]; then
      5   echo "Please run this script from the root of the source tree!"
      6   exit 1
      7 fi
      8 
      9 COMMIT_HASH=""
     10 if [ ! -z $1 ]; then
     11   COMMIT_HASH=$1
     12 fi
     13 
     14 cleanup() {
     15     if [ -d $GANA_TMP ]; then
     16       rm -rf $GANA_TMP
     17     fi
     18     cd $MAILBOX_SRC_ROOT
     19 }
     20 
     21 # This is more portable than `which' but comes with
     22 # the caveat of not(?) properly working on busybox's ash:
     23 existence()
     24 {
     25     type "$1" >/dev/null 2>&1
     26 }
     27 
     28 gana_update()
     29 {
     30     echo "Updating GANA..."
     31     if ! existence git; then
     32       echo "Script requires git"
     33       exit 1
     34     fi
     35     if ! existence recfmt; then
     36       echo "Script requires recutils"
     37       exit 1
     38     fi
     39     GANA_TMP=`mktemp -d`
     40     cd $GANA_TMP || exit 1
     41     git clone git+ssh://git@git.gnunet.org/gana.git || exit 1
     42     cd gana || exit 1
     43     if [ ! -z "${COMMIT_HASH}" ]; then
     44       git checkout "${COMMIT_HASH}" || exit 1
     45     fi
     46     # GNS
     47     echo "Updating Taler error codes"
     48     make -C gnu-taler-error-codes taler_error_codes.go  >/dev/null && \
     49        cp gnu-taler-error-codes/taler_error_codes.go $MAILBOX_SRC_ROOT/internal/gana/ || exit 1
     50     echo "Updating Taler signatures"
     51     make -C gnunet-signatures taler_signatures.go  >/dev/null && \
     52        cp gnunet-signatures/taler_signatures.go $MAILBOX_SRC_ROOT/internal/gana/ || exit 1
     53 
     54     echo "GANA finished"
     55     cd $MAILBOX_SRC_ROOT
     56 }
     57 
     58 trap cleanup EXIT
     59 gana_update