2016-09-14 10:07:52 +00:00
|
|
|
# dependencies_check
|
|
|
|
# $@ Dependnecy files to check
|
|
|
|
#
|
|
|
|
# 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-15 03:15:25 +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
|
|
|
|
if ! hash ${dep%:*} 2>/dev/null; then
|
|
|
|
missing="${missing:+$missing }${dep#*:}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$missing" ]]; then
|
|
|
|
echo "Reqired dependencies not installed"
|
|
|
|
echo
|
|
|
|
echo "This can be resolved on Debian/Raspbian systems by installing:"
|
|
|
|
echo "$missing"
|
|
|
|
false
|
|
|
|
fi
|
|
|
|
}
|