# 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://www.micressor.ch/content/download/aspsms-t/${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}"
src_install() {
dodoc AUTHORS INSTALL COPYING ChangeLog
insinto /usr/doc/${PF}
doins aspsms-t.exec.pl aspsms.notification.pl
use doc && dodoc -r docs
insinto /usr/lib/${PN}
doins -r ASPSMS config.pm Presence.pm Iq.pm aspsms-t.pl
dosed "s:^use lib \"\./\";$:use lib \"/usr/lib/${PN}\";:" \
/usr/lib/${PN}/${PN}.pl
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 aspsms.xml.dist ${PN}.xml
fperms 600 /etc/jabber/${PN}.xml
fowners jabber:jabber /etc/jabber/${PN}.xml
dosed "s:[^\<]*:/var/spool/jabber/sms.YOURHOST:" \
/etc/jabber/${PN}.xml
newinitd ${FILESDIR}/${P}.initd ${PN}
}
pkg_postinst() {
einfo "Move /usr/doc/${P}/${PN/-t/}.notification.pl in your webroot"
einfo "and make it executable"
}