| 1 | #!/bin/shscip-shell filesystem . . `/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=$(basenamescip-shell system . . basename. $0) |
| 11 | |
| 12 | : ${GIT:=git} |
| 13 | : ${REPO:=https://github.com/leedm777/swagger-ui.git} |
| 14 | : ${BRANCH:=asterisk} |
| 15 | |
| 16 | if ! testscip-shell system . . test. -d static-http; then |
| 17 | echoscip-shell system . . echo. "${PROGNAME}: Must run from Asterisk source directory" >&2 |
| 18 | exit 1 |
| 19 | fi |
| 20 | |
| 21 | set -ex |
| 22 | |
| 23 | CLONE_DIR=$(mktempscip-shell system . . mktemp. -d /tmp/swagger-ui.XXXXXXscip-shell filesystem . . `/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 | rmscip-shell system . . rm. -rf static-http/swagger-ui |
| 29 | cpscip-shell system . . cp. -a ${CLONE_DIR}/dist static-http/swagger-ui |
| 30 | |
| 31 | catscip-shell system . . 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 |