build.sh: Add dependency checking

Includes new script scripts/dependencies_check
pull/16/head
T. Joseph Carter 2016-09-14 02:51:28 -07:00
parent 18689a71e0
commit 8789968a14
4 changed files with 39 additions and 1 deletions

View File

@ -5,7 +5,7 @@
#Dependencies
`quilt kpartx realpath qemu-user-static debootstrap zerofree pxz`
`quilt kpartx realpath qemu-user-static debootstrap zerofree pxz zip`
#Config

View File

@ -156,6 +156,10 @@ export QUILT_NO_DIFF_TIMESTAMPS=1
export QUILT_REFRESH_ARGS="-p ab"
source ${SCRIPT_DIR}/common
source ${SCRIPT_DIR}/dependencies_check
dependencies_check ${BASE_DIR}/depends
mkdir -p ${WORK_DIR}
log "Begin ${BASE_DIR}"

5
depends Normal file
View File

@ -0,0 +1,5 @@
quilt
qemu-arm-static:qemu-user-static
debootstrap
kpartx zerofree
pxz zip

View File

@ -0,0 +1,29 @@
# 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=`cat ${BASE_DIR}/depends | tr '\n' ' '`
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
}