summaryrefslogtreecommitdiff
path: root/contrib/scripts/get_swagger_ui.sh
blob: f6e9cedf22015868d8cc6e63ccb8a320aacf9160 (plain)
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
#!/bin/sh

#
# Downloads Swagger-UI to put in static-http.
#
# Swagger-UI is a Swagger compliant HTML+JavaScript web app, which can be used
# to browse ARI (Asterisk REST Interface).
#

PROGNAME=$(basename $0)

: ${GIT:=git}
: ${REPO:=https://github.com/leedm777/swagger-ui.git}
: ${BRANCH:=asterisk}

if ! test -d static-http; then
    echo "${PROGNAME}: Must run from Asterisk source directory" >&2
    exit 1
fi

set -ex

CLONE_DIR=$(mktemp -d /tmp/swagger-ui.XXXXXX) || exit 1
trap "rm -rf ${CLONE_DIR}" EXIT

${GIT} clone -q -b ${BRANCH} ${REPO} ${CLONE_DIR}

rm -rf static-http/swagger-ui
cp -a ${CLONE_DIR}/dist static-http/swagger-ui

cat <<EOF
Swagger-UI downloaded. Install using 'make install'.

To use, enable  ARI (ari.conf), the HTTP server (http.conf) and static
content (also http.conf).
EOF