aboutsummaryrefslogtreecommitdiffstats
path: root/check-depends.sh
diff options
context:
space:
mode:
Diffstat (limited to 'check-depends.sh')
-rwxr-xr-xcheck-depends.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/check-depends.sh b/check-depends.sh
new file mode 100755
index 0000000..7845719
--- /dev/null
+++ b/check-depends.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# $1: program name, $2: package name
+check_dep_bin() {
+ if ! type "$1" >/dev/null 2>&1; then
+ echo "Binary '$1' not found in path, please install $2."
+ exit 1
+ fi
+}
+
+# $1: module name, $2: package name
+check_dep_python2_module() {
+ if ! echo "import $1" | python2 - >/dev/null 2>&1; then
+ echo "Failed to import '$1' module, please install $2."
+ exit 1
+ fi
+}
+
+check_dep_bin mscgen mscgen
+check_dep_bin xsltproc libxslt
+check_dep_bin git git
+check_dep_bin a2x asciidoc
+check_dep_bin asciidoc asciidoc
+check_dep_bin dblatex dblatex
+check_dep_bin packetdiag nwdiag
+check_dep_bin dot graphviz
+check_dep_bin python2 python2
+check_dep_python2_module pychart python2-pychart
+
+echo "All dependencies installed!"