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.
 
 
 
 
 

39 lines
945 B

  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 ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then
  28. echo "Module binfmt_misc not loaded in host"
  29. echo "Please run:"
  30. echo " sudo modprobe binfmt_misc"
  31. exit 1
  32. fi
  33. }