-
Notifications
You must be signed in to change notification settings - Fork 7
/
docbook-builds.sh
executable file
·70 lines (53 loc) · 1.75 KB
/
docbook-builds.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
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#-----------------------------------------------------------------------------
#
# MantisBT manuals build
#
# This script is intended to be scheduled with cron, and will build the
# MantisBT manual.
#
#-----------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Parameters (edit variables as appropriate)
#
# Log file - set to /dev/null for no log
LOGFILE=/var/log/$(basename "$0" .sh).log
#LOGFILE=/dev/null
# MantisBT repository, used to retrieve the build script (since 2.25.0)
# and to checkout the reference to build
# To avoid cluttering the log with unnecessary output, configure the repo
# with `git config advice.detachedHead false`
pathRepo=/srv/mantisbt
# Target directory for manuals
pathDocs=/srv/www/docs
# References to process
# Comma-delimited list of branches, prefixed by remote (e.g. origin/master)
refs=origin/master
# Languages to build (blank = all)
lang=
#------------------------------------------------------------------------------
# Functions
#
function log()
{
DATE=$(date +"%F %T")
echo "$@"
echo "$DATE $*" >>"$LOGFILE"
}
#------------------------------------------------------------------------------
# Main
#
log "Building MantisBT manuals"
cd "$pathRepo" >> "$LOGFILE" || exit 1
# Update reference repository
log "Updating repository in '$pathRepo'"
git checkout --force master |tee -a "$LOGFILE"
git pull --rebase |tee -a "$LOGFILE"
# Force build
if [[ "$1" = "-f" ]] || [[ "$1" = "--force" ]]
then
force="--force"
fi
build/docbook-manual-repo.py --all $force --ref=$refs "$pathRepo" "$pathDocs" "$lang" 2>&1 |tee -a "$LOGFILE"
log "Build complete"
echo "--------------------------------------------" >>"$LOGFILE"