-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathzip-docs.sh
executable file
·57 lines (46 loc) · 1.55 KB
/
zip-docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# print help
if [ "$1" = "--help" ] ; then
echo "
SYNOPSIS
zip-docs.sh [OPTION]
DESCRIPTION
This script allows you (and Travis) to zip the compiled LaTeX documents of the Monolith project. Before using this script, execute script 'build-latex.sh'.
OPTION
-r, --release : Profile for release export.
-rc, --release-clean : As -r or --release. After zip is built this option deletes the directory used to zip."
exit 0
fi
source common.config
TOZIP=$PDFROOT
CLEAN=false
# delete all files except pdfs
find "$PDFROOT" -type f ! -name '*.pdf' -delete
# if 'release' profile selected, copy docs to 'release' location
if [ "$1" = "-r" -o "$1" = "--release" -o "$1" = "-rc" -o "$1" = "--release-clean" ] ; then
set -x
rm -r "$RELEASE"
mkdir -p "$RELEASE"/Interni
mkdir -p "$RELEASE"/Esterni
find "$PDFROOT"/Interni -name "*.pdf" -exec cp {} "$RELEASE"/Interni \;
find "$PDFROOT"/Esterni -name "*.pdf" -exec cp {} "$RELEASE"/Esterni \;
mkdir "$RELEASE"/Esterni/Verbali
mkdir "$RELEASE"/Interni/Verbali
find "$RELEASE" -name "Verbale E*" -exec mv {} "$RELEASE"/Esterni/Verbali/ \;
find "$RELEASE" -name "Verbale I*" -exec mv {} "$RELEASE"/Interni/Verbali/ \;
find "$RELEASE" -name "Lettera*" -exec mv {} "$RELEASE"/ \;
TOZIP=$RELEASE
set +x
fi
if [ "$1" = "-rc" -o "$1" = "--release-clean" ] ; then
CLEAN=true
fi
if [ -e Documentazione.zip ] ; then
rm Documentazione.zip
fi
# zip output directory for Travis deployment
zip -r Documentazione.zip "$TOZIP"
if [ "$CLEAN" = true ] ; then
echo "Cleaning..."
rm -r "$TOZIP"
fi