safe_asterisk: Cleanup and debian compatibility.
[asterisk/asterisk.git] / contrib / scripts / get_swagger_ui.sh
1 #!/bin/sh
2
3 #
4 # Downloads Swagger-UI to put in static-http.
5 #
6 # Swagger-UI is a Swagger compliant HTML+JavaScript web app, which can be used
7 # to browse ARI (Asterisk REST Interface).
8 #
9
10 PROGNAME=$(basename $0)
11
12 : ${GIT:=git}
13 : ${REPO:=https://github.com/leedm777/swagger-ui.git}
14 : ${BRANCH:=asterisk}
15
16 if ! test -d static-http; then
17     echo "${PROGNAME}: Must run from Asterisk source directory" >&2
18     exit 1
19 fi
20
21 set -ex
22
23 CLONE_DIR=$(mktemp -d /tmp/swagger-ui.XXXXXX) || exit 1
24 trap "rm -rf ${CLONE_DIR}" EXIT
25
26 ${GIT} clone -q -b ${BRANCH} ${REPO} ${CLONE_DIR}
27
28 rm -rf static-http/swagger-ui
29 cp -a ${CLONE_DIR}/dist static-http/swagger-ui
30
31 cat <<EOF
32 Swagger-UI downloaded. Install using 'make install'.
33
34 To use, enable  ARI (ari.conf), the HTTP server (http.conf) and static
35 content (also http.conf).
36 EOF