2013-08-01 17:47:32 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function path_to_name {
|
|
|
|
PROGRAMPATH=$1
|
|
|
|
echo ${PROGRAMPATH//\_/\ }
|
|
|
|
}
|
2016-03-01 11:44:10 +01:00
|
|
|
if [ "$1" = '' ]
|
|
|
|
then
|
|
|
|
rep='.'
|
|
|
|
else
|
|
|
|
rep="$1"
|
|
|
|
fi
|
2013-08-02 10:42:38 +02:00
|
|
|
|
2017-09-29 12:49:00 +02:00
|
|
|
function buildProg()
|
|
|
|
{
|
|
|
|
directory="$1"
|
|
|
|
cat > programme_options.tex <<EOB
|
|
|
|
\\newcommand{\\formation}{$(path_to_name $(basename ${directory%/programme}))}
|
2013-08-01 17:47:32 +02:00
|
|
|
\\newcommand{\\dossier}{$directory}
|
|
|
|
EOB
|
2017-09-29 12:49:00 +02:00
|
|
|
xelatex programme.tex
|
|
|
|
xelatex programme.tex
|
|
|
|
set -x
|
|
|
|
mv programme.pdf $directory/plan_de_formation_$(basename ${directory%/programme}).pdf
|
|
|
|
set +x
|
|
|
|
rm -f programme_options.tex
|
|
|
|
}
|
2013-08-02 10:42:38 +02:00
|
|
|
|
2017-09-29 12:49:00 +02:00
|
|
|
if [[ -n ${1} ]]
|
|
|
|
then
|
|
|
|
if [[ -d ${1} ]]
|
|
|
|
then
|
|
|
|
buildProg "${1}/programme"
|
|
|
|
else
|
|
|
|
echo "$1 does not exits !"
|
|
|
|
exit 4
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
for directory in $(find . -name programme -type d); do
|
|
|
|
buildProg $directory
|
|
|
|
done
|
|
|
|
tar -cf plans_de_formation.tar.gz --xform s:^.*/:: $(find . -name "plan_de_formation_*.pdf" -type f)
|
|
|
|
fi
|