blob: 48f7780f883fc7293ce0084dd34c2cb2f9ab0398 [file] [log] [blame]
Oliver Smith52e57972018-12-07 14:19:46 +01001#!/bin/sh -ex
2# environment variables:
3# * PUBLISH: upload manuals after building if set to "1"
4
5base="$PWD"
6export OSMO_GSM_MANUALS_DIR="$base/osmo-gsm-manuals"
7
8# Sanity check
9if ! [ -d "$base/doc/manuals" ]; then
10 echo "ERROR: this script needs to be executed from the top dir of osmo-gsm-tester.git."
11 exit 1
12fi
13
14# Clone/update osmo-gsm-manuals and wipe local modifications
15if [ -d "$OSMO_GSM_MANUALS_DIR" ]; then
16 git -C "$OSMO_GSM_MANUALS_DIR" pull
17else
18 git clone "https://git.osmocom.org/osmo-gsm-manuals" "$OSMO_GSM_MANUALS_DIR"
19fi
20git -C "$OSMO_GSM_MANUALS_DIR" checkout -f HEAD
21
22# Copy manuals source to empty temp dir (so we can easily clean up afterwards)
23temp="$base/_manuals_temp"
24if [ -d "$temp" ]; then
25 rm -rf "$temp"
26fi
27cp -r "$base/doc/manuals" "$temp"
28
29# Build the manuals
30cd "$temp"
31make
32make check
33
34# Publish
35if [ "$PUBLISH" = "1" ]; then
36 make publish
37fi
38
39# Clean up
40rm -r "$temp"