bootstrap (1236B)
1 #!/bin/sh 2 3 4 # This is more portable than `which' but comes with 5 # the caveat of not(?) properly working on busybox's ash: 6 existence() 7 { 8 command -v "$1" >/dev/null 2>&1 9 } 10 11 check_uncrustify() 12 { 13 if existence uncrustify; then 14 echo "Installing uncrustify hook and configuration" 15 ln -fs contrib/build-common/conf/uncrustify.cfg uncrustify.cfg 2> /dev/null 16 ln -fs contrib/build-common/conf/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null 17 else 18 echo "Uncrustify not detected, hook not installed." 19 echo "Please install uncrustify if you plan on doing development" 20 fi 21 } 22 23 submodules() 24 { 25 # Try to update the submodule. Since bootstrap 26 # is also invoked by distributors, we must 27 # ignore any failing of this function as we 28 # could have no outgoing network connection 29 # in a restricted environment. 30 if ! git --version >/dev/null; then 31 echo "git not installed, skipping submodule update" 32 else 33 git submodule update --init || true 34 git submodule update --recursive --remote || true 35 git submodule sync || true 36 fi 37 } 38 39 auto_reconf() 40 { 41 autoreconf -fi 42 } 43 44 main() 45 { 46 submodules 47 check_uncrustify 48 auto_reconf 49 } 50 51 main "$@"