To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / deploy / any / prepare.sh @ 1601:07deb8466f65
History | View | Annotate | Download (1.79 KB)
| 1 | 1593:83412a0a2389 | Chris | #!/bin/bash |
|---|---|---|---|
| 2 | |||
| 3 | # To be sourced into a container-specific start.sh file, not run |
||
| 4 | # standalone |
||
| 5 | |||
| 6 | usage() {
|
||
| 7 | echo "Usage: $0 <database-password> <api-key> <api-httpauth-password>" 1>&2 |
||
| 8 | exit 2 |
||
| 9 | } |
||
| 10 | |||
| 11 | dbpass="$1" |
||
| 12 | if [ -z "$dbpass" ]; then |
||
| 13 | usage |
||
| 14 | fi |
||
| 15 | |||
| 16 | apikey="$2" |
||
| 17 | if [ -z "$apikey" ]; then |
||
| 18 | usage |
||
| 19 | fi |
||
| 20 | |||
| 21 | apipass="$3" |
||
| 22 | if [ -z "$apipass" ]; then |
||
| 23 | usage |
||
| 24 | fi |
||
| 25 | |||
| 26 | set -eu -o pipefail |
||
| 27 | |||
| 28 | rootdir="$mydir/../.." |
||
| 29 | |||
| 30 | deploydir="$rootdir"/deploy |
||
| 31 | if [ ! -d "$deploydir" ]; then |
||
| 32 | echo "ERROR: Unexpected repository layout - expected directory at $deploydir" |
||
| 33 | exit 2 |
||
| 34 | fi |
||
| 35 | |||
| 36 | managerdir="$deploydir/vagrant" |
||
| 37 | if [ ! -d "$managerdir" ]; then |
||
| 38 | echo "ERROR: Required directory $managerdir not found" |
||
| 39 | exit 2 |
||
| 40 | fi |
||
| 41 | |||
| 42 | configdir="$deploydir/config" |
||
| 43 | if [ ! -d "$configdir" ]; then |
||
| 44 | echo "ERROR: Required directory $configdir not found" |
||
| 45 | exit 2 |
||
| 46 | fi |
||
| 47 | |||
| 48 | if [ ! -f "$rootdir/postgres-dumpall" ]; then |
||
| 49 | echo "ERROR: I expect to find a Postgres SQL multi-db dump file in $rootdir/postgres-dumpall" |
||
| 50 | exit 2 |
||
| 51 | fi |
||
| 52 | |||
| 53 | fontdir="$rootdir"/public/themes/soundsoftware/stylesheets/fonts |
||
| 54 | if [ ! -f "$fontdir/24BC0E_0_0.woff" ]; then |
||
| 55 | echo "ERROR: I expect to find necessary webfonts in $fontdir" |
||
| 56 | exit 2 |
||
| 57 | fi |
||
| 58 | |||
| 59 | apischeme=http |
||
| 60 | apihost=localhost |
||
| 61 | |||
| 62 | #apischeme=https |
||
| 63 | #apihost=code.soundsoftware.ac.uk |
||
| 64 | |||
| 65 | for f in "$configdir"/*.in "$rootdir"/extra/soundsoftware/extract-docs.sh ; do |
||
| 66 | out="$configdir"/$(basename "$f" .in).gen |
||
| 67 | cat "$f" | sed \ |
||
| 68 | -e 's/INSERT_DATABASE_PASSWORD_HERE/'"$dbpass"'/g' \ |
||
| 69 | -e 's/INSERT_API_KEY_HERE/'"$apikey"'/g' \ |
||
| 70 | -e 's/INSERT_API_SCHEME_HERE/'"$apischeme"'/g' \ |
||
| 71 | -e 's/INSERT_API_HOST_HERE/'"$apihost"'/g' \ |
||
| 72 | -e 's/INSERT_API_USER_HERE/user/g' \ |
||
| 73 | -e 's/INSERT_API_PASSWORD_HERE/'"$apipass"'/g' \ |
||
| 74 | > "$out" |
||
| 75 | done |