pnp4nagios/helpers/wiki2html.sh

43 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2017-05-20 15:26:21 +02:00
#!/bin/bash
#set -xv
LANG="de en"
LANG_TARGET=(de_DE en_US)
FILES=( about advanced config doc_complete dwnld install modes new-features npcd pages perfdata_format rrdcached rrd_convert start timeranges tpl_helper tpl_helper_pnp tpl_custom tpl upgrade verify verify_pnp_config webfe_cfg webfe wrapper xport mobile )
DESTDIR="../share/pnp/documents"
URL="http://docs.pnp4nagios.org"
cd $DESTDIR
lindex=0
for L in $LANG; do
if [ "$L" == "en" ];then
PART="pnp-0.6"
else
PART="$L/pnp-0.6"
fi
T=${LANG_TARGET[$lindex]}
mkdir $T
index=0
documents=${#FILES[@]}
while [ "$index" -lt "$documents" ];do
F=${FILES[$index]}
echo "$L $F"
wget -nv -O "${T}/${F}.html" "${URL}/${PART}/${F}?do=export_xhtmlbody"
sed -i -e's/ü/\ü/g' "${T}/${F}.html"
sed -i -e's/Ü/\Ü/g' "${T}/${F}.html"
sed -i -e's/ä/\ä/g' "${T}/${F}.html"
sed -i -e's/Ä/\Ä/g' "${T}/${F}.html"
sed -i -e's/ö/\ö/g' "${T}/${F}.html"
sed -i -e's/Ö/\Ö/g' "${T}/${F}.html"
((index++))
done
((lindex++))
done
rm de_DE/dwnld.html
ln -s en_US/dwnld.html de_DE/dwnld.html