2016-09-14 06:07:52 -04:00
|
|
|
# dependencies_check
|
2017-07-27 06:11:07 -04:00
|
|
|
# $@ Dependency files to check
|
2016-09-14 06:07:52 -04: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 15:08:24 -05:00
|
|
|
deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${BASE_DIR}/depends")"
|
2016-09-14 06:07:52 -04:00
|
|
|
|
|
|
|
fi
|
|
|
|
for dep in $deps; do
|
2018-03-02 15:08:24 -05:00
|
|
|
if ! hash "${dep%:*}" 2>/dev/null; then
|
2016-09-14 06:07:52 -04:00
|
|
|
missing="${missing:+$missing }${dep#*:}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$missing" ]]; then
|
2017-07-27 06:11:07 -04:00
|
|
|
echo "Required dependencies not installed"
|
2016-09-14 06:07:52 -04:00
|
|
|
echo
|
|
|
|
echo "This can be resolved on Debian/Raspbian systems by installing:"
|
|
|
|
echo "$missing"
|
|
|
|
false
|
|
|
|
fi
|
2019-02-16 12:06:13 -05:00
|
|
|
|
|
|
|
|
|
|
|
if ! lsmod | grep binfmt_misc >/dev/null
|
|
|
|
then
|
|
|
|
echo "Module binfmt_misc not loaded in host"
|
|
|
|
echo "Please run:"
|
|
|
|
echo " sudo modprobe binfmt_misc"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-09-14 06:07:52 -04:00
|
|
|
}
|