mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	This is just a quick script for dumping swagger-ui into static-http,
so that it can be served by the Asterisk web server. I had to change the Makefile in order to recursively install content from the static-http directory, hence the code review instead of just putting it in. Review: https://reviewboard.asterisk.org/r/2924/ ........ Merged revisions 401261 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										13
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Makefile
									
									
									
									
									
								
							@@ -437,12 +437,15 @@ distclean: $(SUBDIRS_DIST_CLEAN) _clean
 | 
			
		||||
 | 
			
		||||
datafiles: _all doc/core-en_US.xml
 | 
			
		||||
	CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
 | 
			
		||||
# Should static HTTP be installed during make samples or even with its own target ala
 | 
			
		||||
# webvoicemail?  There are portions here that *could* be customized but might also be
 | 
			
		||||
# improved a lot.  I'll put it here for now.
 | 
			
		||||
 | 
			
		||||
	for x in static-http/*; do \
 | 
			
		||||
		$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/static-http" ; \
 | 
			
		||||
#	# Recursively install contents of the static-http directory, in case
 | 
			
		||||
#	# extra content is provided there. See contrib/scripts/get_swagger_ui.sh
 | 
			
		||||
	find static-http | while read x; do \
 | 
			
		||||
		if test -d $$x; then \
 | 
			
		||||
			$(INSTALL) -m 755 -d "$(DESTDIR)$(ASTDATADIR)/$$x"; \
 | 
			
		||||
		else \
 | 
			
		||||
			$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/$$x" ; \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
	$(INSTALL) -m 644 doc/core-en_US.xml "$(DESTDIR)$(ASTDATADIR)/static-http";
 | 
			
		||||
	$(INSTALL) -m 644 doc/snapshots.xslt "$(DESTDIR)$(ASTDATADIR)/static-http";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								contrib/scripts/get_swagger_ui.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								contrib/scripts/get_swagger_ui.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,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
 | 
			
		||||
		Reference in New Issue
	
	Block a user