You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

54 lines
1.2 KiB

  1. # dependencies_check
  2. # $@ Dependency files to check
  3. #
  4. # Each dependency is in the form of a tool to test for, optionally followed by
  5. # a : and the name of a package if the package on a Debian-ish system is not
  6. # named for the tool (i.e., qemu-user-static).
  7. dependencies_check()
  8. {
  9. local depfile deps missing
  10. for depfile in "$@"; do
  11. if [[ -e "$depfile" ]]; then
  12. deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${BASE_DIR}/depends")"
  13. fi
  14. for dep in $deps; do
  15. if ! hash "${dep%:*}" 2>/dev/null; then
  16. missing="${missing:+$missing }${dep#*:}"
  17. fi
  18. done
  19. done
  20. if [[ "$missing" ]]; then
  21. echo "Required dependencies not installed"
  22. echo
  23. echo "This can be resolved on Debian/Raspbian systems by installing:"
  24. echo "$missing"
  25. false
  26. fi
  27. # If we're building on a native arm platform, we don't need to check for
  28. # binfmt_misc or require it to be loaded.
  29. binfmt_misc_required=1
  30. case $(uname -m) in
  31. aarch64)
  32. binfmt_misc_required=0
  33. ;;
  34. arm*)
  35. binfmt_misc_required=0
  36. ;;
  37. esac
  38. if [[ "${binfmt_misc_required}" == "1" ]]; then
  39. if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then
  40. echo "Module binfmt_misc not loaded in host"
  41. echo "Please run:"
  42. echo " sudo modprobe binfmt_misc"
  43. exit 1
  44. fi
  45. fi
  46. }