Skip to content
Snippets Groups Projects
Commit ae2feae6 authored by Tomas Lovato's avatar Tomas Lovato
Browse files

revise manual_build.sh toward a friendly usability (avoid manual settings)

parent 30f533b7
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
#set -x
# Available manuals
manuals='NEMO SI3 TOP'
# Initialization of the options
x_p='' ; x_r=''
# Choice of the options ---
while getopts hpr: option; do
case $option in
('h') cat <<EOF
Usage:
------
./manual_build.sh [-p] [-r version ] manual
Mandatory
Chose one model manual among ${manuals} or all
Optional
-p Produce manual with figures and disable draft watermark
-r Specify the release version number of the manual(s)
EOF
exit 0 ;;
('p') x_p=0 ; shift ;;
('r') x_r=${OPTARG}; shift 2;;
esac
done
shift $(($OPTIND));
VER_NUM=${x_r}
DRAFT=${x_p}
CMP_NAM=$1
## Initialisation
##---------------
## Default selection for models
if [ "$1" = 'all' ]; then
models='NEMO SI3 TOP'
elif [ "$1" = '' ]; then
# Model
if [ "${CMP_NAM}" == 'all' ] ; then
models="$manuals"
elif [ "${CMP_NAM}" == '' ]; then
models='NEMO'
elif [[ "${manuals}" == *"${CMP_NAM}"* ]] ; then
models="${CMP_NAM}"
else
models=$*
echo "No entry for manual ${CMP_NAM}"
exit
fi
# Version
version=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match || "trunk"`
if [ "x${VER_NUM}" != 'x' ] ; then
version=${VER_NUM}
fi
# Draft mode
ifdraft=1 ; draft_opt="using draft mode"
if [ "x${DRAFT}" != 'x' ] ; then
ifdraft=0 ; draft_opt=""
fi
echo "Compiling ${models} manual(s) at version ${version} ${draft_opt} \n"
# Set version
version=`echo $version | sed -e 's;_;\\\\\\\_;g'`
prefile="latex/global/preamble.tex"
sed -i '' -e "s;\\\def\\\ver.*;\\\def\\\ver{$version};" ${prefile}
# Set draft mode
docfile="latex/global/document.tex"
pkgfile="latex/global/packages.tex"
draft_opt=`grep draft $docfile`
pkg_dft=`grep draftwatermark $pkgfile | sed -e "s;%;;g"`
if [ $ifdraft == 1 ] && [ "x$draft_opt" == "x" ] ; then
sed -i '' -e "s;,abstract;,abstract,draft;" $docfile
sed -i '' -e "s;.*draftwatermark.*;\\$pkg_dft;" $pkgfile
elif [ $ifdraft == 0 ] && [ "x$draft_opt" != "x" ] ; then
sed -i '' -e "s;abstract,draft;abstract;" $docfile
sed -i '' -e "s;.*draftwatermark.*;%\\$pkg_dft;" $pkgfile
fi
# Echo current font path
fontawesome=`grep defaultfontfeatures latex/global/packages.tex | sed -e 's/.*=\(.*\)}/\1/'`
echo "Fontawesome path is $fontawesome \n"
# Source shared functions
. tools/shr_func.sh
......@@ -29,7 +100,7 @@ fi
##-------------------
for model in $models; do
echo $model
echo "Start compiling manual for $model"
# clean $model
build $model
printf "\t¤ End of building run\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment