bootstrap 759 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. export SCRIPT_DIR=$(dirname "$0")
  3. ##
  4. ## Bootstrap Process
  5. ##
  6. main ()
  7. {
  8. local submodules=$(git submodule status)
  9. local result=$?
  10. if [ "$result" -ne "0" ]
  11. then
  12. exit $result
  13. fi
  14. if [ -n "$submodules" ]
  15. then
  16. echo "*** Updating submodules..."
  17. update_submodules
  18. fi
  19. }
  20. bootstrap_submodule ()
  21. {
  22. local bootstrap="script/bootstrap"
  23. if [ -e "$bootstrap" ]
  24. then
  25. echo "*** Bootstrapping $name..."
  26. "$bootstrap" >/dev/null
  27. else
  28. update_submodules
  29. fi
  30. }
  31. update_submodules ()
  32. {
  33. git submodule sync --quiet && git submodule update --init && git submodule foreach --quiet bootstrap_submodule
  34. }
  35. export -f bootstrap_submodule
  36. export -f update_submodules
  37. main