Newer versions of the helper scripts upstream
This commit is contained in:
parent
2421500713
commit
6ccce8ff31
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -26,9 +26,10 @@
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
. "../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,53 @@ _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()
|
||||||
|
{
|
||||||
|
echo "docbook.sh: $@" 1>&2
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
|
@ -84,25 +132,27 @@ if [ $# -eq 0 ]; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#check the variables
|
||||||
|
if [ -z "$PACKAGE" ]; then
|
||||||
|
_error "The PACKAGE variable needs to be set"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||||
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
||||||
|
|
||||||
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"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -123,16 +173,11 @@ while [ $# -gt 0 ]; do
|
||||||
#install
|
#install
|
||||||
if [ "$install" -eq 1 ]; then
|
if [ "$install" -eq 1 ]; then
|
||||||
$DEBUG $MKDIR -- "$instdir" || exit 2
|
$DEBUG $MKDIR -- "$instdir" || exit 2
|
||||||
$DEBUG $INSTALL -- "$target" "$instdir/$target" || exit 2
|
$DEBUG $INSTALL "$target" "$instdir/$target" || exit 2
|
||||||
continue
|
continue
|
||||||
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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2010-2013 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2010-2014 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#variables
|
#variables
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
. "../config.sh"
|
[ -f "../config.sh" ] && . "../config.sh"
|
||||||
LOCALEDIR="$PREFIX/share/locale"
|
LOCALEDIR="$PREFIX/share/locale"
|
||||||
POTFILES="POTFILES"
|
POTFILES="POTFILES"
|
||||||
#executables
|
#executables
|
||||||
|
@ -49,6 +49,14 @@ _debug()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#error
|
||||||
|
_error()
|
||||||
|
{
|
||||||
|
echo "gettext.sh: $@" 1>&2
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
|
@ -125,6 +133,12 @@ if [ $# -eq 0 ]; then
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#check the variables
|
||||||
|
if [ -z "$PACKAGE" ]; then
|
||||||
|
_error "The PACKAGE variable needs to be set"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
LOCALEDIR="$PREFIX/share/locale"
|
LOCALEDIR="$PREFIX/share/locale"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
target="$1"
|
target="$1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user