# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
DESCRIPTION="Jabber2SMS-gateway via aspsms.com"
HOMEPAGE="http://www.micressor.ch/content/projects/aspsms-t"
SRC_URI="http://svn.micressor.ch/public/${PN}/files/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="doc"
DEPEND="dev-lang/perl
net-im/jabber-base"
RDEPEND="dev-perl/Object-MultiType
dev-perl/Authen-SASL
dev-perl/Digest-SHA1
dev-perl/XML-Parser
dev-perl/XML-Smart
dev-perl/Net-Jabber"
S=${WORKDIR}/${PN}_${PV}
src_install() {
dodoc INSTALL COPYING ChangeLog || die
insinto /usr/doc/${PF}
doins ${PN}.pl aspsms.notification.pl || die
use doc && dodoc -r docs
insinto /usr/lib/${PN}
doins -r ASPSMS config.pm Presence.pm Iq.pm aspsms-t.pl InMessage.pm || die
dosed "s:^use lib \"\./\";$:use lib \"/usr/lib/${PN}\";:" \
/usr/lib/${PN}/${PN}.pl || die
exeinto /usr/bin
echo "#! /bin/bash
perl /usr/lib/${PN}/${PN}.pl -c /etc/jabber/${PN}.xml >/dev/null" > ${PN}
doexe ${PN}
insinto /etc/jabber
newins etc/aspsms.xml.dist ${PN}.xml || die
fperms 600 /etc/jabber/${PN}.xml || die
fowners jabber:jabber /etc/jabber/${PN}.xml || die
dosed "s:[^\<]*:/var/spool/jabber/sms.YOURHOST:" \
/etc/jabber/${PN}.xml || die
newins etc/fees.xml sms-fees.xml || die
newins etc/networks.xml sms-networks.xml || die
dosed 's:\./etc/fees.xml:/etc/jabber/sms-fees.xml:' \
/usr/lib/${PN}/config.pm || die
dosed 's:\./etc/networks.xml:/etc/jabber/sms-networks.xml:' \
/usr/lib/${PN}/config.pm || die
newinitd ${FILESDIR}/${P}.initd ${PN} || die
}
pkg_postinst() {
einfo "Move /usr/doc/${P}/${PN/-t/}.notification.pl in your webroot"
einfo "and make it executable"
}