Oliver Smith | 52e5797 | 2018-12-07 14:19:46 +0100 | [diff] [blame] | 1 | #!/bin/sh -ex |
| 2 | # environment variables: |
| 3 | # * PUBLISH: upload manuals after building if set to "1" |
| 4 | |
| 5 | base="$PWD" |
| 6 | export OSMO_GSM_MANUALS_DIR="$base/osmo-gsm-manuals" |
| 7 | |
| 8 | # Sanity check |
| 9 | if ! [ -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 |
| 12 | fi |
| 13 | |
| 14 | # Clone/update osmo-gsm-manuals and wipe local modifications |
| 15 | if [ -d "$OSMO_GSM_MANUALS_DIR" ]; then |
| 16 | git -C "$OSMO_GSM_MANUALS_DIR" pull |
| 17 | else |
| 18 | git clone "https://git.osmocom.org/osmo-gsm-manuals" "$OSMO_GSM_MANUALS_DIR" |
| 19 | fi |
| 20 | git -C "$OSMO_GSM_MANUALS_DIR" checkout -f HEAD |
| 21 | |
| 22 | # Copy manuals source to empty temp dir (so we can easily clean up afterwards) |
| 23 | temp="$base/_manuals_temp" |
| 24 | if [ -d "$temp" ]; then |
| 25 | rm -rf "$temp" |
| 26 | fi |
| 27 | cp -r "$base/doc/manuals" "$temp" |
| 28 | |
| 29 | # Build the manuals |
| 30 | cd "$temp" |
| 31 | make |
| 32 | make check |
| 33 | |
| 34 | # Publish |
| 35 | if [ "$PUBLISH" = "1" ]; then |
| 36 | make publish |
| 37 | fi |
| 38 | |
| 39 | # Clean up |
| 40 | rm -r "$temp" |