diff options
author | Thomas De Schampheleire <patrickdepinguin@gmail.com> | 2013-10-18 22:31:25 +0200 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2013-11-01 16:41:04 +0100 |
commit | 6fb84874b2545d25fdb85b4b2a0a5c8fac1c6305 (patch) | |
tree | 6ecc9ee5aae6faf44de5a2b2b37dcd085775816a /support/dependencies/check-host-asciidoc.sh | |
parent | a2ffd684924880f3a59d2ed875afb8cc8d2ed823 (diff) |
manual generation: check dependencies first
To generate the manual, you need a few tools. If these are not present,
pretty cryptic error messages are given.
This patch adds a simple check for these dependencies, before attempting to
build the manual.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support/dependencies/check-host-asciidoc.sh')
-rwxr-xr-x | support/dependencies/check-host-asciidoc.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/support/dependencies/check-host-asciidoc.sh b/support/dependencies/check-host-asciidoc.sh new file mode 100755 index 000000000..fc5fcba44 --- /dev/null +++ b/support/dependencies/check-host-asciidoc.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +candidate="$1" #ignored + +asciidoc=`which asciidoc` +if [ ! -x "$asciidoc" ]; then + # echo nothing: no suitable asciidoc found + exit 1 +fi + +# Output of 'asciidoc --version' examples: +# asciidoc 8.6.7 +version=`$asciidoc --version | cut -d\ -f2` +major=`echo "$version" | cut -d. -f1` +minor=`echo "$version" | cut -d. -f2` +bugfix=`echo "$version" | cut -d. -f3` + +# To generate the manual, we need asciidoc >= 8.6.3 +major_min=8 +minor_min=6 +bugfix_min=3 +if [ $major -gt $major_min ]; then + echo $asciidoc +else + if [ $major -eq $major_min -a $minor -ge $minor_min ]; then + echo $asciidoc + else + if [ $major -eq $major_min -a $minor -eq $minor_min \ + -a $bugfix -ge $bugfix_min ]; then + echo $asciidoc + else + # echo nothing: no suitable asciidoc found + exit 1 + fi + fi +fi |