buildDocExports : Added a script to build archives and export all doc export in other directory

This commit is contained in:
Benjamin Renard 2009-11-13 18:05:59 +01:00
parent 1dc188444d
commit 0c503cbeee
3 changed files with 176 additions and 4 deletions

139
buildDocExports.sh Executable file
View file

@ -0,0 +1,139 @@
#!/bin/sh
ROOT_DIR=$( cd `dirname $0`; pwd )
# Import config
if [ ! -f $LOCAL_SAV_DIR/local.sh ]
then
echo "Error : You don't have create your own local.sh file in config.local directory. You could rely on the local.sh.example file to create your version."
exit 1
fi
source $LOCAL_SAV_DIR/local.sh
if [ ! -n "$EXPORT_DOC_DIR" ]
then
echo "The EXPORT_DOC_DIR variable is not define. Export doc is disabled."
exit 0
fi
DOC_DIR=$ROOT_DIR/doc
TMP_DIR=`mktemp -d`
ERROR=0
echo "Export documentation in $EXPORT_DOC_DIR :"
# PDF
if [ -n "$PDF" ]
then
echo -en "\t- PDF : "
# PDF
cp -f $DOC_DIR/exports/pdf/LdapSaisie.pdf $EXPORT_DOC_DIR/LdapSaisie.pdf
if [ $? -ne 0 ]
then
echo Error
ERROR=1
else
echo Ok
fi
fi
# ALL-IN-ONE
if [ -n "$ALL_IN_ONE" ]
then
echo -en "\t- All-In-One : "
rm -fr $TMP_DIR/$ALL_IN_ONE
mkdir $TMP_DIR/$ALL_IN_ONE
cp $DOC_DIR/exports/html/all-in-one/LdapSaisie.html $TMP_DIR/$ALL_IN_ONE/
sed -i 's/\.\.\/\.\.\/\.\.\///g' $TMP_DIR/$ALL_IN_ONE/LdapSaisie.html
# IMAGES
cp -fr $IMAGES $TMP_DIR/$ALL_IN_ONE/images
mkdir $TMP_DIR/$ALL_IN_ONE/styles
cp $CSS $TMP_DIR/$ALL_IN_ONE/styles/
echo "Build archive and move it later ..."
fi
# ONLINE
if [ -n "$ONLINE" ]
then
echo -en "\t- On-line : "
rm -fr $TMP_DIR/$ONLINE
mkdir $TMP_DIR/$ONLINE
cp -fr $DOC_DIR/exports/html/online/*.html $TMP_DIR/$ONLINE
sed -i 's/\.\.\/\.\.\/\.\.\///g' $TMP_DIR/$ONLINE/*
# IMAGES
cp -fr $IMAGES $TMP_DIR/$ONLINE/images
mkdir $TMP_DIR/$ONLINE/styles
cp $CSS $TMP_DIR/$ONLINE/styles/
echo "Build archive and move it later ..."
fi
# DOCBOOK
if [ -n "$DOCBOOK" ]
then
echo -en "\t- Docbook : "
rm -fr $TMP_DIR/$DOCBOOK
mkdir $TMP_DIR/$DOCBOOK
cd $DOC_DIR
for i in `find -type d|grep -v 'export'`
do
mkdir -p $TMP_DIR/$DOCBOOK/$i
done
for i in `find -type f|grep -v '(Makefile|^./export)'`
do
cp $i $TMP_DIR/$DOCBOOK/$i
done
echo "Build archive and move it later ..."
fi
echo "Build archives and move all in export directory :"
cd $TMP_DIR/
for i in $ALL_IN_ONE $ONLINE $DOCBOOK
do
echo -e "\t$i : "
echo -en "\t\t+ Archive : "
tar -cjf LdapSaisie--Doc--$i.tar.bz2 $i && mv LdapSaisie--Doc--$i.tar.bz2 $EXPORT_DOC_DIR/
if [ $? -eq 0 ]
then
echo Ok
else
echo Erreur
ERROR=1
fi
echo -en "\t\t+ Web dir : "
rm -fr $EXPORT_DOC_DIR/$i/* && cp -fr $i/* $EXPORT_DOC_DIR/$i/ && rm -fr $i
if [ $? -eq 0 ]
then
echo Ok
else
echo Erreur
ERROR=1
fi
done
if [ -n "$LAST_UPDATE_FILE" ]
then
echo -n "Create last-update file : "
echo "Last update :" > $LAST_UPDATE_FILE
date >> $LAST_UPDATE_FILE
echo >> $LAST_UPDATE_FILE
echo done.
fi
rm -fr $TMP_DIR

View file

@ -10,5 +10,33 @@ LOG_FILE="$ROOT_DIR/upgrade.log"
#THEME="mytheme"
# Do doc export ?
DO_DOC=1
BUILD_DOC=1
# The export dir
# If EXPORT_DIR is a zero length string, will not export doc
EXPORT_DOC_DIR=/var/www/ldapsaisie-doc
# PDF export name file
# If PDF is a zero length string, pdf doc export will not build
PDF=LdapSaisie.pdf
# ALL_IN_ONE export name
# If ALL_IN_ONE is a zero length string, all-in-one doc export will not build
ALL_IN_ONE=all-in-one
# On-line export name
# If ONLINE is a zero length string, on-line doc export will not build
ONLINE=online
# Docbook export name
# If DOCBOOK is a zero length string, docbook doc export will not buil
DOCBOOK=docbook
# The CSS file to use in export
CSS=$DOC_DIR/styles/LS.css
# The image doc directory
IMAGES=$DOC_DIR/images
# The name of last update file
LAST_UPDATE_FILE=$EXPORT_DIR/last_update.txt

View file

@ -51,7 +51,7 @@ do
fi
done
if [ $DO_DOC -eq 1 ]
if [ $BUILD_DOC -eq 1 ]
then
msg "-> Clean the doc : " -en
cd $ROOT_DIR/doc >> $LOG_FILE && make clean >> $LOG_FILE && cd - >> $LOG_FILE
@ -165,7 +165,7 @@ then
msg "Ok"
fi
if [ $DO_DOC -eq 1 ]
if [ $BUILD_DOC -eq 1 ]
then
msg "-> Do you want export the documentation (y/N) ? " -en
read a
@ -180,5 +180,10 @@ then
else
msg "Ok"
fi
fi
if [ -n "$EXPORT_DOC_DIR" ]
then
$ROOT_DIR/buildDocExports.sh
fi
fi
fi