# mini-asterisk-gui package # David Rowe 1 January 2010 # # A simple, light weight GUI for Asterisk. # # To create ipkg: # $ make -f mini-asterisk-gui.mk mini-asterisk-gui-package # include rules.mk MINI_NAME=mini-asterisk-gui MINI_SITE=https://freetel.svn.sourceforge.net/svnroot/$(MINI_NAME) export TARGET_DIR=$(TOPDIR)/tmp/$(MINI_NAME)/ipkg/$(MINI_NAME) export MINI_DIR=$(BUILD_DIR)/$(MINI_NAME) PKG_NAME:=$(MINI_NAME) PKG_VERSION:=1.0 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(TOPDIR)/tmp/$(MINI_NAME) ######################################################################### # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # The Free Software Foundation; version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # Copyright @ 2008 Astfin and # Primary Authors: mark@astfin.org, li@astfin.org ######################################################################### .PHONY : $(MINI_DIR) $(MINI_DIR): if [ -d $(MINI_DIR) ]; then \ cd $(MINI_DIR); svn up; \ else \ svn co $(MINI_SITE); \ fi # set version number in about.sh cd $(MINI_DIR) ; \ ver=`svn info | grep Revision`; echo $$ver; \ sed -i "s/Revision: [0-9]*/$$ver/" $(MINI_DIR)/cgi-bin/about.sh mini-asterisk-gui: $(MINI_DIR) rm -Rf $(TARGET_DIR) mkdir -p $(TARGET_DIR)/etc/asterisk mkdir -p $(TARGET_DIR)/www # we can't over write existing .conf files as "ipkg install" # will complain and choke so we install them as the "default" # files then let the postinst script rename them cp $(MINI_DIR)/etc/asterisk/extensions.conf $(TARGET_DIR)/etc/asterisk/extensions.conf.def cp $(MINI_DIR)/etc/asterisk/sip.conf $(TARGET_DIR)/etc/asterisk/sip.conf.def cp $(MINI_DIR)/cgi-bin/* $(TARGET_DIR)/www # avoid clash with existing index.html, e.g. from lighttpd mv $(TARGET_DIR)/www/index.html $(TARGET_DIR)/www/index-mini.html touch $(PKG_BUILD_DIR)/.built all: mini-asterisk-gui define Package/$(PKG_NAME)/postinst #!/bin/sh -x # turn off Asterisk internal web server sed -i "s/enabled=.*/enabled=no/g" /etc/asterisk/http.conf # lose users.conf mv /etc/asterisk/users.conf /etc/asterisk/users.conf.backup # make backup copies of current conf files cp /etc/asterisk/extensions.conf /etc/asterisk/extensions.conf.backup cp /etc/asterisk/sip.conf etc/asterisk/sip.conf.backup # finish installation of our conf files, leaving .def versions for # the "reset defaults" feature on admin screen cp /etc/asterisk/extensions.conf.def /etc/asterisk/extensions.conf cp /etc/asterisk/sip.conf.def /etc/asterisk/sip.conf /etc/init.d/asterisk stop /etc/init.d/asterisk start # enable Perl and shell CGI support in lighttpd sed -i 's_^#cgi.assign.*_cgi.assign = \( ".sh" => "/bin/sh",".pl" => "/usr/bin/perl" )_' /etc/lighttpd.conf # mv existing index.html out of the way mv /www/index.html /www/index-lighttpd.html mv /www/index-mini.html /www/index.html /etc/init.d/lighttpd stop /etc/init.d/lighttpd start endef # pre-remove define Package/$(PKG_NAME)/prerm #!/bin/sh -x mv /www/index-lighttpd.html /www/index.html # recover .conf files mv /etc/asterisk/users.conf.backup /etc/asterisk/users.conf mv /etc/asterisk/extensions.conf.backup /etc/asterisk/extensions.conf mv /etc/asterisk/sip.conf.backup /etc/asterisk/sip.conf sed -i "s/enabled=.*/enabled=yes/g" /etc/asterisk/http.conf /etc/init.d/asterisk stop /etc/init.d/asterisk start endef define Package/$(PKG_NAME) SECTION:=net CATEGORY:=Network DEPENDS:= network-static network-backdoor lighttpd login perl busybox pagecache TITLE:=Minimal, easy to use Asterisk Web GUI DESCRIPTION:=\ Mini Asterisk is a set of scripts that implement a simple Web \ GUI for Asterisk. Everything is pre-configured, Analog and \ ports and SIP phones and trunks are automatically detected. The \ learning curve is a few minutes and it has comprehensive \ tool-tip documentation. Mini Asterisk is 'unfeatured' - it \ hides many of the advanced Asterisk features in the interest \ of simple and fast configuration. URL:=http://rowetel.com/ucasterisk/mini.html/ endef $(eval $(call BuildPackage,$(PKG_NAME))) mini-asterisk-gui-package: mini-asterisk-gui $(PACKAGE_DIR)/$(PKG_NAME)_$(VERSION)_$(PKGARCH).ipk