get_swagger_ui.sh 808 B

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