bootstrap (1181B)
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 if [ -d .git ]; then 12 # Make sure that "git pull" et al. also update 13 # submodules to avoid accidental rollbacks. 14 git config --local submodule.recurse true 15 16 # Beware: We only want to update submodules to the commit hash 17 # stored in git, otherwise builds based on tags will not be 18 # reproducible. 19 echo "$0: Updating submodules" 20 echo | git submodule update --init --force 21 fi 22 ./contrib/check-prebuilt 23 24 # This is more portable than `which' but comes with 25 # the caveat of not(?) properly working on busybox's ash: 26 existence() 27 { 28 command -v "$1" >/dev/null 2>&1 29 } 30 31 set -x 32 33 if existence uncrustify; then 34 echo "Installing uncrustify hook and configuration" 35 # Install uncrustify format symlink (if possible) 36 ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null || true 37 # Install pre-commit hook (if possible) 38 ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null || true 39 else 40 echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development" 41 fi