Newer version of the scripts upstream

This commit is contained in:
Pierre Pronchery 2014-03-04 02:39:57 +01:00
parent 7dce2219b0
commit d80d123c3a
2 changed files with 44 additions and 13 deletions

View File

@ -29,6 +29,7 @@ PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh" [ -f "../config.sh" ] && . "../config.sh"
#executables #executables
DEBUG="_debug" DEBUG="_debug"
FOP="fop"
INSTALL="install -m 0644" INSTALL="install -m 0644"
MKDIR="mkdir -m 0755 -p" MKDIR="mkdir -m 0755 -p"
RM="rm -f" RM="rm -f"
@ -44,6 +45,45 @@ _debug()
} }
#docbook
_docbook()
{
target="$1"
source="${target%.*}.xml"
ext="${target##*.}"
ext="${ext##.}"
case "$ext" in
html)
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;;
pdf)
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
$DEBUG $FOP -fo "${target%.*}.fo" -pdf "$target"
$RM -- "${target%.*}.fo"
;;
1|2|3|4|5|6|7|8|9)
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;;
*)
echo "$0: $target: Unknown type" 1>&2
return 2
;;
esac
if [ $? -ne 0 ]; then
echo "$0: $target: Could not create page" 1>&2
$RM -- "$target"
return 2
fi
}
#error #error
_error() _error()
{ {
@ -78,7 +118,7 @@ while getopts "ciuP:" name; do
uninstall=1 uninstall=1
;; ;;
P) P)
PREFIX="$2" PREFIX="$OPTARG"
;; ;;
?) ?)
_usage _usage
@ -103,20 +143,16 @@ fi
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
source="${target%.*}.xml"
shift shift
#determine the type #determine the type
ext="${target##*.}" ext="${target##*.}"
ext="${ext##.}" ext="${ext##.}"
case "$ext" in case "$ext" in
html) html|pdf)
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
instdir="$DATADIR/doc/$ext/$PACKAGE" instdir="$DATADIR/doc/$ext/$PACKAGE"
;; ;;
1|2|3|4|5|6|7|8|9) 1|2|3|4|5|6|7|8|9)
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
instdir="$MANDIR/man$ext" instdir="$MANDIR/man$ext"
;; ;;
*) *)
@ -142,11 +178,6 @@ while [ $# -gt 0 ]; do
fi fi
#create #create
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
#XXX ignore errors #XXX ignore errors
if [ $? -ne 0 ]; then _docbook "$target" || break
echo "$0: $target: Could not create page" 1>&2
$RM -- "$target"
break
fi
done done

View File

@ -119,7 +119,7 @@ while getopts "ciuP:" name; do
uninstall=1 uninstall=1
;; ;;
P) P)
PREFIX="$2" PREFIX="$OPTARG"
;; ;;
?) ?)
_usage _usage