# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit webapp MY_P=${PN}_snapshot_2006-06-08 MY_PV=${PV/_pre1/} DESCRIPTION="GUI dialer application for the Asterisk PBX" HOMEPAGE="http://astguiclient.sourceforge.net/" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip" LICENSE="GPL-2" KEYWORDS="~amd64 ~x86" IUSE="" DEPEND="${DEPEND} virtual/httpd-php >=net-misc/asterisk-1.2.7" RDEPEND="${DEPEND} >=dev-db/mysql-4.1.12 dev-perl/MD5 perl-core/Digest-MD5 dev-perl/Digest-SHA1 dev-perl/Spreadsheet-ParseExcel dev-perl/Term-ReadLine-Perl perl-core/Time-HiRes dev-perl/OLE-StorageLite media-sound/sox >=app-misc/screen-4 net-misc/ntp media-libs/ploticus >=sys-process/lsof-4" DEPEND="${DEPEND} app-arch/unzip" S="${WORKDIR}" src_unpack() { unpack ${A} cd ${S} sed -i -e "s:/home/cron:/usr/share/${PN}:g" *.pl *.at sed -i -e "s:\\\/home\\\/cron:\\\/usr\\\/share\\\/${PN}:g" *.pl sed -i -e "s:/usr/local/apache2/htdocs:/var/www/localhost/htdocs/astguiclient:g" */dbconnect.php } src_install() { webapp_src_preinst einfo "Installing main files" dodir ${MY_HTDOCSDIR} cp -r agc ${D}${MY_HTDOCSDIR}/ webapp_configfile ${MY_HTDOCSDIR}/agc/dbconnect.php cp -r VICIDIAL_web ${D}${MY_HTDOCSDIR}/vicidial rm ${D}${MY_HTDOCSDIR}/vicidial/Copy* webapp_configfile ${MY_HTDOCSDIR}/vicidial/dbconnect.php cp -r astguiclient_web ${D}${MY_HTDOCSDIR}/astguiclient webapp_configfile ${MY_HTDOCSDIR}/astguiclient/dbconnect.php webapp_serverowned -R ${MY_HTDOCSDIR}/agc webapp_serverowned -R ${MY_HTDOCSDIR}/vicidial webapp_serverowned -R ${MY_HTDOCSDIR}/astguiclient exeinto /var/lib/asterisk/agi-bin doexe *.agi insinto /var/lib/asterisk/sounds doins DTMF_sounds/* keepdir /var/spool/asterisk/monitor/DONE keepdir /var/spool/asterisk/monitor/ORIG keepdir /usr/share/${PN}/LOGS keepdir /usr/share/${PN}/VICIDIAL/LEADS_IN/DONE exeinto /usr/share/${PN} doexe *.pl doexe *.at insinto /usr/share/${PN} doins test_VICIDIAL_lead_file.txt phone_codes_GMT.txt ${FILESDIR}/${MY_PV}.sql.gz gunzip ${D}/usr/share/${PN}/${MY_PV}.sql.gz exeinto /etc/cron.hourly newexe ${FILESDIR}/cronhourly astguiclient exeinto /etc/cron.weekly newexe ${FILESDIR}/cronweekly astguiclient insinto /etc/asterisk newins ${FILESDIR}/extensions.conf extensions.${PN}.conf newins ${FILESDIR}/meetme.conf meetme.${PN}.conf newins ${FILESDIR}/manager.conf manager.${PN}.conf dodoc docs/*.txt webapp_src_install } pkg_config() { einfo "Please press \"ctrl+c\" now if you are upgrading from an old" einfo "installation and consult the upgrade documentation. Otherwise," einfo "please give a password for the mysql 'cron' user." ewarn "Avoid [\"'\\_%] characters in the password." read -rsp " >" pwd1 ; echo einfo "Please re-enter the password." read -rsp " >" pwd2 ; echo if [[ "x$pwd1" != "x$pwd2" ]] ; then die "Passwords are not the same" fi einfo "please type in your MySQL root password to create the database." cat /usr/share/${PN}/${MY_PV}.sql | sed -e "s:CRONPWD:${pwd1}:g" > /tmp/${PF}.sql mysql -u root -p < /tmp/${PF}.sql rm -r /tmp/${PF}.sql einfo "A temporary admin user has been set up with the username \"Admin\"" einfo "and the password \"test\". Please change this by visiting the" einfo "astguiclient administration page:" einfo "http://localhost/${PN}/astguiclient/admin.php" ewarn "PLEASE NOTE: You will need to update the following configuration" ewarn "files to take advantage of the password you just typed in:" ewarn "HTDOCSDIR/${PN}/{agc,astguiclient,vicidial}/dbconnect.php" } pkg_postinst() { einfo "To set up the MySQL database, run:" einfo "\"emerge --config =net-misc/${PF}\"" einfo "Please make sure, however, that your MySQL database is running." ewarn "Please note that you must have a cron daemon running, such as" ewarn "vixie-cron." einfo "Sample configurations for astguiclient are available at:" einfo "\t/etc/asterisk/extensions.${PN}.conf" einfo "\t/etc/asterisk/meetme.${PN}.conf" webapp_pkg_postinst }