taldir

Directory service to resolve wallet mailboxes by messenger addresses
Log | Files | Refs | Submodules | README | LICENSE

gana_update.sh (1323B)


      1 # This is more portable than `which' but comes with
      2 # the caveat of not(?) properly working on busybox's ash:
      3 TALDIR_SRC_ROOT=$PWD
      4 if [ ! -f $TALDIR_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 $GNUNET_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 $TALDIR_SRC_ROOT/internal/gana/ || exit 1
     50 
     51     echo "GANA finished"
     52     cd $TALDIR_SRC_ROOT
     53 }
     54 
     55 trap cleanup EXIT
     56 gana_update