1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
raspberrypi-build/functions/dependencies_check.sh

27 lines
733 B
Bash
Raw Normal View History

# 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).
2017-07-02 03:09:19 +00:00
dependencies_check() {
2017-07-02 12:17:08 +00:00
local missing
2017-07-02 12:17:08 +00:00
if [[ -f "$1" ]]; then
for dep in $(cat "$1"); do
2017-07-02 12:05:50 +00:00
if ! hash ${dep%:*} 2>/dev/null; then
missing="${missing:+$missing }${dep#*:}"
fi
done
2017-07-02 12:17:08 +00:00
fi
2017-07-02 12:05:50 +00:00
if [[ "$missing" ]]; then
2017-07-02 12:21:40 +00:00
tput setaf 1 # Red color
2017-07-02 12:19:53 +00:00
echo 'Reqired dependencies not installed.'
echo 'This can be resolved on Debian/Raspbian systems by installing the following packages:'
2017-07-02 12:05:50 +00:00
echo "$missing"
2017-07-02 12:21:40 +00:00
tput sgr0 # No color
2017-07-02 12:05:50 +00:00
false
fi
}