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
|
|
|
|
|
|
|
|
2019-03-06 16:25:42 +00:00
|
|
|
if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then
|
2019-02-16 17:06:13 +00:00
|
|
|
echo "Module binfmt_misc not loaded in host"
|
|
|
|
echo "Please run:"
|
|
|
|
echo " sudo modprobe binfmt_misc"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-09-14 10:07:52 +00:00
|
|
|
}
|