bootstrap (2517B)
1 #!/bin/sh 2 # This file is in the public domain. 3 4 set -eu 5 6 if ! git --version >/dev/null; then 7 echo "git not installed" 8 exit 1 9 fi 10 11 # Make sure that "git pull" et al. also update 12 # submodules to avoid accidental rollbacks. 13 git config --local submodule.recurse true 14 15 echo "$0: Updating submodules" 16 # Caution: We do NOT want to fetch the latest version with --remote, 17 # but instead always the one that's recorded in the repository. 18 echo | git submodule update --init --force 19 20 ./contrib/check-prebuilt 21 22 # This is more portable than `which' but comes with 23 # the caveat of not(?) properly working on busybox's ash: 24 existence() 25 { 26 command -v "$1" >/dev/null 2>&1 27 } 28 29 # Freeze SQL files that must no longer be edited. 30 for n in 0001 0002 0003 0004 0005 0006 0007 0008 31 do 32 chmod -w src/exchangedb/exchange-$n.sql* 33 chmod -w src/exchangedb/$n-*.sql &> /dev/null || true 34 done 35 for n in 0001 36 do 37 chmod -w src/exchangedb/auditor-triggers-$n.sql* 38 done 39 for n in 0001 0002 40 do 41 chmod -w src/auditordb/auditor-$n.sql* 42 chmod -w src/auditordb/$n-*.sql &> /dev/null || true 43 done 44 45 if existence uncrustify; then 46 echo "Installing uncrustify hook and configuration" 47 # Install uncrustify format symlink (if possible) 48 ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null || true 49 # Install pre-commit hook (if possible) 50 ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null || true 51 else 52 echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development" 53 fi 54 55 56 # Generate Makefile.am in contrib/ 57 cd contrib 58 rm -f Makefile.am 59 echo 'dist_amlspapkgdata_DATA = \' > Makefile.am.ext 60 find wallet-core/aml-backoffice/ -type f | sort | awk '{print " " $1 " \\" }' >> Makefile.am.ext 61 # Remove extra '\' at the end of the file 62 truncate -s -2 Makefile.am.ext 63 64 echo "" >> Makefile.am.ext 65 echo 'dist_kycspapkgdata_DATA = \' >> Makefile.am.ext 66 find wallet-core/kyc/ -type f | sort | awk '{print " " $1 " \\" }' >> Makefile.am.ext 67 # Remove extra '\' at the end of the file 68 truncate -s -2 Makefile.am.ext 69 70 echo "" >> Makefile.am.ext 71 echo 'dist_auditorspapkgdata_DATA = \' >> Makefile.am.ext 72 find wallet-core/auditor-backoffice/ -type f | sort | awk '{print " " $1 " \\" }' >> Makefile.am.ext 73 # Remove extra '\' at the end of the file 74 truncate -s -2 Makefile.am.ext 75 76 77 cat Makefile.am.in Makefile.am.ext >> Makefile.am 78 # Prevent accidental editing of the generated Makefile.am 79 chmod -w Makefile.am 80 cd .. 81 82 echo "$0: Running autoreconf" 83 autoreconf -fi