# this caused issues with builds on el4
#%{?dist: %{expand: %%define %dist 1}}
Summary: OpenSource server implementation of the Jabber protocols
Name: jabberd
Version: 2.0s11
Release: 3
License: GPL
Group: System Environment/Daemons
Source0: http://files.jabberstudio.org/jabberd2/jabberd-2.0s11.tar.gz
Source1: jabberd
Source2: jabberd.sysconfig
URL: http://jabberd.jabberstudio.org/2/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel libidn-devel
%{!?_without_pam:BuildRequires: pam-devel}
%{!?_without_db4:BuildRequires: db4-devel}
%{!?_without_ldap:BuildRequires: openldap-devel}
%{!?_without_mysql:BuildRequires: mysql-devel}
%{!?_without_postgresql:BuildRequires: postgresql-devel}
Requires(post): openssl chkconfig /sbin/service
# No friggin way. this is so cool. Cept it doesnt work.
#%{?el4: Requires(post): atomic-release }
Requires(pre): shadow-utils
Requires(preun): chkconfig shadow-utils /sbin/service
Requires(postun): chkconfig /sbin/service
%description
The jabberd project aims to provide an open-source server implementation of the
Jabber protocols for instant messaging and XML routing. The goal of this
project is to provide a scalable, reliable, efficient and extensible server
that provides a complete set of features and is up to date with the latest
protocol revisions.
jabberd 2 is the next generation of the jabberd server. It has been rewritten
from the ground up to be scalable, architecturally sound, and to support the
latest protocol extensions coming out of the JSF.
This packages defaults to use pam and the Berkeley DB.
%prep
%setup -q -n %{name}-%{version}
%build
%define _sysconfdir /etc/jabberd
%define sysconfdir /etc/jabberd
%{__sed} -i -e "s,sysconfdir=\"\$sysconfdir\/jabberd\",#&,g" configure
%configure \
%{!?_without_pam:--enable-pam} \
%{?_without_pam:--disable-pam} \
%{!?_without_db4:--enable-db} \
%{?_without_db4:--disable-db} \
%{!?_without_mysql:--enable-mysql} \
%{!?_without_mysql:--with-extra-library-path=%{_libdir}/mysql} \
%{?_without_mysql:--disable-mysql} \
%{!?_without_ldap:--enable-ldap} \
%{?_without_ldap:--disable-ldap} \
%{!?_without_postgresql:--enable-pgsql} \
%{?_without_postgresql:--disable-pgsql} \
%{?el3: --with-extra-include-path=/usr/kerberos/include } \
%{?rh9: --with-extra-include-path=/usr/kerberos/include } \
--localstatedir=%{_var}/lib
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf $RPM_BUILD_ROOT
%makeinstall
%define _sysconfdir /etc
%{__mkdir_p} $RPM_BUILD_ROOT/%{_var}/lib/jabberd/{log,pid,db}
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
%{__install} -p -m 644 tools/db-setup.mysql $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__install} -p -m 644 tools/db-setup.pgsql $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__install} -p -m 644 tools/migrate.pl $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__install} -p -m 644 tools/pipe-auth.pl $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__install} -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/%{name}
%{__install} -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
%{__sed} -i -e "s,__BINDIR__,%{_bindir},g" \
-e "s,__ETCDIR__,%{sysconfdir},g" \
-e "s,__PIDDIR__,%{_var}/lib/jabberd/pid,g" \
-e "s,__SYSCONF__,%{_sysconfdir}/sysconfig,g" \
$RPM_BUILD_ROOT%{_initrddir}/%{name} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
%{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/jabberd << END
#%PAM-1.0
auth include system-auth
account include system-auth
session include system-auth
END
#default driver for storage
#the default pam backend needs auto creation of accounts
%{__sed} -i -e ':a;N;$!ba' \
-e 's,mysql,db,g' \
-e 's,,,g' \
$RPM_BUILD_ROOT%{sysconfdir}/sm.xml
#default authentication backend
#enable SSL certificate
#clients must do STARTTLS
%{__sed} -i -e ':a;N;$!ba' \
-e 's,mysql,pam,g' \
-e 's,,/etc/jabberd/server.pem,g' \
-e 's,,,g' \
$RPM_BUILD_ROOT%{sysconfdir}/c2s.xml
#ghost file
touch $RPM_BUILD_ROOT%{sysconfdir}/server.pem
# we have our own start script
%{__rm} $RPM_BUILD_ROOT%{_bindir}/jabberd
# we have our own start script
%{__rm} $RPM_BUILD_ROOT%{sysconfdir}/jabberd.cfg*
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
#creating jabber user
useradd -r -d %{_var}/lib/%{name} -m -c "Jabber Server" -s /bin/bash jabber >/dev/null 2>&1 ||:
%post
if [ "$1" -eq "1" ]; then
#register %{name} service
/sbin/chkconfig --add %{name}
#replace default passwords, yet another hack
export NEWPASS=$( dd if=/dev/urandom bs=20 count=1 2>/dev/null \
| sha1sum | awk '{print $1}' )
cd %{sysconfdir}
%{__sed} -i -f- router-users.xml router.xml <secret,$NEWPASS,g
END
%{__sed} -i -f- *.xml <secret,$NEWPASS,g
END
fi
if [ ! -e /etc/pki/tls ]; then
if [ ! -d /etc/pki ]; then
mkdir /etc/pki
fi
if [ -d /usr/share/ssl/ ]; then
ln -sf /usr/share/ssl/ /etc/pki/tls
fi
fi
#create ssl certificate
cd %{sysconfdir}
if [ ! -e server.pem ]; then
%{___build_shell} %{_sysconfdir}/pki/tls/certs/make-dummy-cert server.pem
%{__chown} root.jabber server.pem
%{__chmod} 640 server.pem
fi
%preun
if [ "$1" -eq "0" ]; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
#jabber user is not deleted to avoid unowned files
#userdel jabber
#should %{_var}/lib/jabberd be deleted???
#%{__rm} -rf %{_var}/lib/jabberd
fi
%postun
if [ "$1" -eq "1" ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1
fi
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README PROTOCOL TODO
%{_bindir}/*
%attr(750, jabber, jabber) %dir %{sysconfdir}/
%attr(640, jabber, jabber) %config(noreplace) %{sysconfdir}/*xml*
%attr(750, jabber, jabber) %dir %{sysconfdir}/templates
%attr(640, jabber, jabber) %config(noreplace) %{sysconfdir}/templates/*xml*
%{_datadir}/man/man8/*
%{_datadir}/%{name}/
%config %{_initrddir}/%{name}
%config(noreplace) %{_sysconfdir}/pam.d/jabberd
%config(noreplace) %{_sysconfdir}/sysconfig/jabberd
%attr(-,jabber,jabber) %{_var}/lib/jabberd
%ghost %{_sysconfdir}/jabberd/server.pem
%changelog
* Wed Apr 25 2007 Scott R. Shinn - 2.0-0.s11.11-3
- update install for centos/rhel 4
* Tue Jan 30 2007 Scott R. Shinn - 2.0-0.s11.11
- tweak on PAM (from fedora extras)
* Tue Jan 30 2007 Scott R. Shinn - 2.0-0.s11.10
- update to fix pki path for el4
* Fri Jul 21 2006 Scott R. Shinn - 2.0-0.s11.9
- update ART spec file for rhel3/rh90
* Sun Nov 27 2005 Adrian Reber - 2.0-0.s10.8
- %%{_sysconfdir}/jabberd/server.pem was listed twice
- added /sbin/service dependency to %%post, %%postun and %%preun
- jabber user is not deleted to avoid unowned files
* Mon Oct 17 2005 Adrian Reber - 2.0-0.s10.7
- updated to 2.0-0.s10
* Mon Aug 01 2005 Adrian Reber - 2.0-0.s9.6
- updated to 2.0-0.s9.6
* Thu May 12 2005 Adrian Reber - 2.0-0.s8.5
- updated to 2.0-0.s8.5
- using new location of make-dummy-cert
* Wed Mar 09 2005 Adrian Reber - 2.0-0.s6.5
- removed Epoch: 0
- more Requires(...)
- typo
- changed db location to %%{_var}/lib/jabberd
- removed noreplace for start script
- make backends optional during build
- use -p with the install command
- combined some of the sed magic
- added a jabberd file in sysconfig to control if all daemons
should be started
- don't suid c2s and add config option in sysconfig/jabberd
to start c2s as root if required to authenticate against pam/shadow
* Tue Mar 08 2005 Adrian Reber - 2.0-0.s6.4
- made password more random (/dev/random)
- replace password in the config without making it visible in ps
- enable ldap, mysql, postgresql backends
- remove dependency on perl during build
- make pam default authentication backend in c2s.xml
- make files in etc (640, jabber, jabber)
- enabled SSL certificate in c2s.xml
- enabled auto creation of accounts in sm.xml (necessary for usage with PAM)
- enabled require-startls
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.3
- changed startscript again
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.2
- changed startscript to support condrestart
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.1
- updated to 2.0s6
* Wed Nov 24 2004 Adrian Reber - 0:2.0-0.fdr.16.s4
- updated to 2.0s4
- added jabberd-c2s-buffers.patch
(http://jabberstudio.org/projects/jabberd2/bugs/view.php?id=4528)
- replace mysql with db in sm.xml
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.15.s3
- add ||: at the end of the useradd line
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.14.s3
- create jabber user in %%pre instead of in %%post
- remove -r from userdel
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.13.s3
- s/jabberd2/%%{name}/
- replace another default password
* Fri Jul 16 2004 Adrian Reber - 0:2.0-0.fdr.12.s3
- %%{_var}/jabberd is now owned be the package
- %%ghost-ing server.pem
- disable rm-ing %%{_var}/jabberd on uninstall
* Fri Jul 16 2004 Adrian Reber - 0:2.0-0.fdr.11.s3
- using %%{_datadir}/ssl/certs/make-dummy-cert to
create the certificate
- added -r to useradd
- added openssl to post-requires
- added libidn-devel and pam-devel as BuildRequires
* Mon Jul 12 2004 Adrian Reber - 0:2.0-0.fdr.10.s3
- complete rewrite for fedora (I mean it)
* Tue May 18 2004 Tim Niemueller
- Initial spec file