bootstrap (1502B)
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 ./contrib/check-prebuilt 26 27 28 # This is more portable than `which' but comes with 29 # the caveat of not(?) properly working on busybox's ash: 30 existence() 31 { 32 command -v "$1" >/dev/null 2>&1 33 } 34 35 # Freeze SQL files that must no longer be edited. 36 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 37 do 38 chmod -w src/backenddb/sql-schema/merchant-$n.sql* 39 done 40 41 if existence uncrustify; then 42 echo "Installing uncrustify hook and configuration" 43 # Install uncrustify format symlink (if possible) 44 ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null || true 45 # Install pre-commit hook (if possible) 46 ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null || true 47 else 48 echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development" 49 fi