2016-09-14 10:07:52 +00:00
|
|
|
# dependencies_check
|
2017-07-27 10:11:07 +00:00
|
|
|
# $@ Dependency files to check
|
2016-09-14 10:07:52 +00:00
|
|
|
#
|
|
|
|
# Each dependency is in the form of a tool to test for, optionally followed by
|
|
|
|
# a : and the name of a package if the package on a Debian-ish system is not
|
|
|
|
# named for the tool (i.e., qemu-user-static).
|
|
|
|
dependencies_check()
|
|
|
|
{
|
|
|
|
local depfile deps missing
|
|
|
|
|
|
|
|
for depfile in "$@"; do
|
|
|
|
if [[ -e "$depfile" ]]; then
|
2018-03-02 20:08:24 +00:00
|
|
|
deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${BASE_DIR}/depends")"
|
2016-09-14 10:07:52 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
for dep in $deps; do
|
2018-03-02 20:08:24 +00:00
|
|
|
if ! hash "${dep%:*}" 2>/dev/null; then
|
2016-09-14 10:07:52 +00:00
|
|
|
missing="${missing:+$missing }${dep#*:}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$missing" ]]; then
|
2017-07-27 10:11:07 +00:00
|
|
|
echo "Required dependencies not installed"
|
2016-09-14 10:07:52 +00:00
|
|
|
echo
|
|
|
|
echo "This can be resolved on Debian/Raspbian systems by installing:"
|
|
|
|
echo "$missing"
|
|
|
|
false
|
|
|
|
fi
|
2019-02-16 17:06:13 +00:00
|
|
|
|
2020-12-20 02:34:20 +00:00
|
|
|
# If we're building on a native arm platform, we don't need to check for
|
|
|
|
# binfmt_misc or require it to be loaded.
|
2019-02-16 17:06:13 +00:00
|
|
|
|
2020-12-20 02:34:20 +00:00
|
|
|
binfmt_misc_required=1
|
|
|
|
|
|
|
|
case $(uname -m) in
|
|
|
|
aarch64)
|
|
|
|
binfmt_misc_required=0
|
|
|
|
;;
|
|
|
|
arm*)
|
|
|
|
binfmt_misc_required=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "${binfmt_misc_required}" == "1" ]]; then
|
|
|
|
if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then
|
|
|
|
echo "Module binfmt_misc not loaded in host"
|
|
|
|
echo "Please run:"
|
|
|
|
echo " sudo modprobe binfmt_misc"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-02-16 17:06:13 +00:00
|
|
|
fi
|
2016-09-14 10:07:52 +00:00
|
|
|
}
|