merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

bootstrap (1476B)


      1 #!/bin/sh
      2 
      3 set -eu
      4 
      5 if ! git --version >/dev/null; then
      6   echo "git not installed"
      7   exit 1
      8 fi
      9 
     10 if ! python3 --version >/dev/null; then
     11   echo "python3 not installed"
     12   exit 1
     13 fi
     14 
     15 # Make sure that "git pull" et al. also update
     16 # submodules to avoid accidental rollbacks.
     17 if [ -d .git ]; then
     18   git config --local submodule.recurse true
     19 
     20   echo "$0: Updating submodules"
     21   # Caution: We do NOT want to fetch the latest version with --remote,
     22   # but instead always the one that's recorded in the repository.
     23   echo | git submodule update --init --force
     24 fi
     25 
     26 # This is more portable than `which' but comes with
     27 # the caveat of not(?) properly working on busybox's ash:
     28 existence()
     29 {
     30     command -v "$1" >/dev/null 2>&1
     31 }
     32 
     33 # Freeze SQL files that must no longer be edited.
     34 for n in 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034
     35 do
     36     chmod -w src/backenddb/sql-schema/merchant-$n.sql*
     37 done
     38 
     39 if existence uncrustify; then
     40     echo "Installing uncrustify hook and configuration"
     41     # Install uncrustify format symlink (if possible)
     42     ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null || true
     43     # Install pre-commit hook (if possible)
     44     ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null || true
     45 else
     46     echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development"
     47 fi