From 0245cbb958238e2c11f7fc446785df3c4c5e833d Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Wed, 14 Sep 2016 03:07:52 -0700 Subject: Dependency checks + important bugfix (#16) --- scripts/dependencies_check | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 scripts/dependencies_check (limited to 'scripts') diff --git a/scripts/dependencies_check b/scripts/dependencies_check new file mode 100644 index 0000000..eba13d8 --- /dev/null +++ b/scripts/dependencies_check @@ -0,0 +1,30 @@ +# 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 + deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < ${BASE_DIR}/depends" + + 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 +} -- cgit v1.2.3