# $Id$

PortSystem		1.0

name			asterisknow
version			2.0
categories		net
platforms		darwin
maintainers		gmail.com:stefan.van.der.eijk

description		GUI for configuring Asterisk
long_description	Asterisk in minutes. The most popular open source PBX software, \
			Asterisk, can now be easily configured with a graphical interface. \
			AsteriskNOW.

homepage		http://www.asterisknow.org
fetch.type		svn
svn.url			http://svn.digium.com/svn/asterisk-gui/branches/2.0/
worksrcdir		${version}

configure.args		--localstatedir=${prefix}/var --sysconfdir=${prefix}/etc/asterisk

depends_run     port:asterisk

post-destroot {
	file mkdir ${destroot}${prefix}/var/lib/asterisk/gui_backups
	file mkdir ${destroot}${prefix}/var/lib/asterisk/static-http/private/bkps
}

post-patch {
	reinplace "s|\"/etc|\"${prefix}/etc|g" ${worksrcpath}/scripts/detectdahdi.sh
	reinplace "s|\"/var|\"${prefix}/var|g" ${worksrcpath}/scripts/dldsoundpack
	reinplace "s|\ /var|\ ${prefix}/var|g" ${worksrcpath}/scripts/dldsoundpack
	reinplace "s|\"/etc|\"${prefix}/etc|g" ${worksrcpath}/scripts/editmisdn.sh
	reinplace "s|\"/etc|\"${prefix}/etc|g" ${worksrcpath}/scripts/editzap.sh
	reinplace "s|\"/var|\"${prefix}/var|g" ${worksrcpath}/scripts/listfiles
	reinplace "s|\"/var|\"${prefix}/var|g" ${worksrcpath}/scripts/mastercsvexists
	reinplace "s|\ /var|\ ${prefix}/var|g" ${worksrcpath}/scripts/mastercsvexists
	reinplace "s|\"/etc|\"${prefix}/etc|g" ${worksrcpath}/scripts/registerg729.sh
	reinplace "s|/bin|/usr/bin|g" ${worksrcpath}/scripts/takebackup
	reinplace "s|\ /etc/asterisk|\ ${prefix}/etc/asterisk|g" ${worksrcpath}/scripts/takebackup
	reinplace "s|\ /var|\ ${prefix}/var|g" ${worksrcpath}/scripts/takebackup
	reinplace "s|\ /etc|\ ${prefix}/etc|g" ${worksrcpath}/config/js/index.js
	reinplace "s|\'/etc|\'${prefix}/etc|g" ${worksrcpath}/config/js/index.js
	reinplace "s|\'/var|\'${prefix}/var|g" ${worksrcpath}/config/js/index.js
}