root / autotools / docbook-wrapper @ e8230860
History | View | Annotate | Download (553 Bytes)
1 |
#!/bin/sh |
---|---|
2 |
|
3 |
set -e |
4 |
|
5 |
input="${1}" |
6 |
output="${2}" |
7 |
|
8 |
case "${output}" in |
9 |
*.pdf) cmd=docbook2pdf ;; |
10 |
*.html) cmd='docbook2html --nochunks' ;; |
11 |
*.7|*.8) cmd=docbook2man ;; |
12 |
*) |
13 |
echo "Unknown filetype: ${output}" >&2 |
14 |
exit 1 |
15 |
;; |
16 |
esac |
17 |
|
18 |
tmpdir=`mktemp -d` |
19 |
trap "rm -rf ${tmpdir}" EXIT |
20 |
|
21 |
if ! ( cd `dirname ${input}` && |
22 |
${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; ) |
23 |
then |
24 |
echo "Building ${output} failed." >&2 |
25 |
exit 1 |
26 |
fi; |
27 |
|
28 |
mv "${tmpdir}/`basename "${output}"`" "${output}" |
29 |
|
30 |
# Needed for make to recognize output file |
31 |
touch "${output}" |