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
|
2016-09-14 23:15:25 -04: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
|
|
|
|
if ! hash ${dep%:*} 2>/dev/null; then
|
|
|
|
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
|
|
|
|
}
|