#!/bin/bash
#H File : updt-manuals.bash
#D Copy all testeds manuals in working/man directory and to /usr/local/man
#D if Installdir is /urs/local
VERSION=211126
#O Include install variables
pwd > pwd.txt
if cat pwd.txt | grep ~/Annexer
then Workdir=~/Annexer
elif cat pwd.txt | grep ~/Add_appendix
then Workdir=~/Add_appendix
else echo "Workind directory not found"
exit -1
fi
rm pwd.txt
#O Download global variables
source $Workdir/vars/installdir.var
if test -z $$Mandir
then Mandir=$Installdir/man
fi
if test -z $Sbindir
then Sbindir=$Installdir/sbin
fi
#O Copy all tested manuals files in this man directory
cd $Workdir/tests/02-manuels
if test -L $Workdir/man
then
mkdir -p $Workdir/man/{man1,de/man1,en/man1,es/man1,fr/man1}
# manuals
cp -uR man1 *.gz $Workdir/man/man1/.
cp -uR de/man1/*.gz $Workdir/man/de/man1/.
cp -uR en/man1/*.gz $Workdir/man/en/man1/.
cp -uR es/man1/*.gz $Workdir/man/es/man1/.
cp -uR fr/man1/*.gz $Workdir/man/fr/man1/.
cp -uR fr.UTF-8/man1/*.gz $Workdir/man/fr/man1/.
# manuals html
cp -uR man1/*.html $Workdir/man/man1/.
cp -uR en/man1/*.html $Workdir/man/en/man1/.
cp -uR fr.UTF-8/man1/*.html $Workdir/man/fr/man1/.
# manuals text
cp -uR man1/*.txt $Workdir/man/man1/.
cp -uR en/man1/*.txt $Workdir/man/en/man1/.
cp -uR fr.UTF-8/man1/*.txt $Workdir/man/fr/man1/.
# recursive doc html and txt
cp -uR de/man1/* $Workdir/mam/de/man1/.
cp -uR fr/man1/* $Workdir/man/fr/man1/.
else
echo "$Workdir/man not found"
exit -1
fi
#O Copy utility files
cp -u docu2html.sh $Workdir/sbin/docu2html
cp -u htmlman.sh $Workdir/sbin/htmlman
cp -u textman.sh $Workdir/sbin/textman
cp -u userman.sh $Workdir/sbin/userman
cp -u updt-manuals.bash $Workdir/sbin/updt-manuals
#O IF Installdir is /usr/local copy all man files and sbin files to /usr/local
if [ "$Installdir" = "/usr/local" ]
then
sudo cp -uR $Workdir/man/* $Mandir/.
sudo cp -uR $Workdir/sbin $Sbindir/.
fi
exit 0
#O End of file updt-manuals.bash