summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Carter <iKarith@users.noreply.github.com>2016-09-14 03:07:52 -0700
committerXECDesign <XECDesign@users.noreply.github.com>2016-09-14 20:07:52 +1000
commit0245cbb958238e2c11f7fc446785df3c4c5e833d (patch)
treed6cf2d87e249d1fd70ea43bdbd5f54463b42e2f1
parent8605ca74b2afdebd5b31405fd36991f753a30ac6 (diff)
Dependency checks + important bugfix (#16)
-rw-r--r--README.md2
-rwxr-xr-xbuild.sh5
-rw-r--r--depends5
-rw-r--r--scripts/dependencies_check30
4 files changed, 40 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2599f5a..bf4c65f 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/build.sh b/build.sh
index 52f7a82..c6abdae 100755
--- a/build.sh
+++ b/build.sh
@@ -17,7 +17,6 @@ EOF
if [ -f ${i}-packages-nr ]; then
log "Begin ${SUB_STAGE_DIR}/${i}-packages-nr"
PACKAGES="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < ${i}-packages-nr)"
- PACKAGES="$(sed -e "$sed_expr_packages" < ${i}-packages-nr)"
if [ -n "$PACKAGES" ]; then
on_chroot sh -e - << EOF
apt-get install --no-install-recommends -y $PACKAGES
@@ -158,6 +157,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}"
diff --git a/depends b/depends
new file mode 100644
index 0000000..bf8712d
--- /dev/null
+++ b/depends
@@ -0,0 +1,5 @@
+quilt
+qemu-arm-static:qemu-user-static
+debootstrap
+kpartx zerofree
+pxz zip
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
+}