jabberd spec

Colin Walters walters at redhat.com
Thu Sep 23 00:30:55 UTC 2004


Hi,

A while ago I spent some free time trying to bang this jabberd .spec
file I found into shape, but haven't had time to pick it up again.  I
think it'd be great though if we got jabberd into Fedora or extras at
least.  Hopefully someone will be able to take this and fix it up more;
it's FHS-incompatible and has some ugly bits like the test for
NETWORKING, etc.


-------------- next part --------------
## The following options can be overriden on build from the command line:
## rpmbuild -ba --define 'use_pgsql 1' --define 'storage pgsql' --define "authreg 'anon pipe pgsql'"
##

# Include module support
%{!?use_db: %define use_db 1}
%{!?use_pgsql: %define use_pgsql 0}
%{!?use_mysql: %define use_mysql 0}
%{!?use_ldap: %define use_ldap 0}

# storage modules
# SM storage drivers to build, one or more of:
# db (requires Berkeley DB)
# fs (NOT RECOMMENDED)
# mysql (requires MySQL)
# pgsql (requires PostgreSQL)
# Defaults to "db".

#define storage modules
%{!?storage:%define storage db}

# authreg modules
# c2s authentication/registration modules to build, one or more of:
# anon
# db (requires Berkeley DB)
# pipe
# ldap (requires OpenLDAP)
# mysql (requires MySQL)
# pam (requires PAM)
# pgsql (requires PostgreSQL)
# Defaults to "anon pipe db".

#define authreg modules
%{!?authreg: %define authreg 'anon pipe db'}

Summary: Jabber Server
Name: jabberd
Version: 2.0s3
Release: 1
License: GPL
Group: System Environment/Daemons
URL: http://jabberd.jabberstudio.org/
Source0: http://www.jabberstudio.org/projects/jabberd2/releases/download.php?file=/%{name}-%{version}.tar.gz
BuildRequires: pam-devel
Requires: openssl >= 0.9.6b
BuildRequires: krb5-devel
BuildRequires: openssl-devel >= 0.9.6b

%if %{use_ldap}
Requires: openldap
BuildRequires: openldap-devel
%endif

%if %{use_pgsql}
Requires: postgresql
BuildRequires: postgresql-devel
%endif

%if %{use_mysql}
Requires: mysql
BuildRequires: mysql-devel
%endif

%if %{use_db}
Requires: db4 >= 4.1.24
BuildRequires: db4-devel >= 4.1.24
%endif

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}

%description
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.

%prep
%setup -q -n %{name}-%{version}

%build

CFLAGS="$RPM_OPT_FLAGS `pkg-config --cflags openssl`"
LDFLAGS="$LDFLAGS `pkg-config --libs openssl`"
export CFLAGS
export LDFLAGS

%configure \
--enable-db \
--enable-authreg=%{authreg} \
--enable-storage=%{storage} \
--with-openssl=%{_prefix} \
--enable-pam \
--enable-debug \
--disable-mysql \
--disable-idn \
--disable-ldap
make

%install
rm -rf $RPM_BUILD_ROOT
#makeinstall
make DESTDIR=%{buildroot} install
mkdir -p $RPM_BUILD_ROOT/%{_var}/%{name}/{db,pid,log}
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/
cat > $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/%{name} << EOF

#
# jabberd Jabber Daemon.
# chkconfig: - 80 20
# description: Jabber is an XML-based, open-source system and protocol for real-time messaging and presence notification.
# processname: jabberd
# config: /etc/jabberd/jabber.cfg

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ X\${NETWORKING} = Xno ] && exit 0

# Check if the Jabber conf file is present
[ -f /etc/jabberd/jabberd.cfg ] || exit 0
[ -d /etc/jabberd ] || exit 0

RETVAL=0

LOGDIR=/var/jabberd/log
JSERV="router resolver sm s2s c2s"
start() {
echo -n \$"Starting jabber server: "
nohup su jabber -c "/usr/bin/jabberd" >>\$LOGDIR/jabberd.log 2>&1 &
RETVAL=\$?
if [ \$RETVAL -eq 0 ]; then
echo_success
echo
touch /var/lock/subsys/jabberd
else
echo_failure
echo
exit 1
fi
chown jabber:jabber \$LOGDIR/jabberd.log
}

stop() {
echo -n \$"Stopping jabberd: "
for serv in \$JSERV ; do
killproc \$serv > /dev/null
[ \$? != 0 ] && RETVAL=\$?
done
if [ \$RETVAL = 0 ]; then
echo_success
else
echo_failure
fi
echo
[ \$RETVAL = 0 ] && rm -f /var/lock/subsys/jabberd
}

dostatus() {
for serv in \$JSERV; do
status \$serv
done
RETVAL=\$?
}

restart() {
stop
start
RETVAL=\$?
}

condrestart() {
[ -e /var/lock/subsys/jabberd ] && restart || :
}

# See how we were called.
case "\$1" in
start)
start
;;
stop)
stop
;;
status)
dostatus
;;
restart|reload)
restart
;;
condrestart)
condrestart
;;
*)
echo "Usage: jabberd {start|stop|status|restart|condrestart}"
exit 1
esac

exit \$RETVAL
EOF



%clean
rm -rf $RPM_BUILD_ROOT

%pre
# Add jabber user account
/usr/sbin/useradd -c 'Jabber daemon' -s /sbin/nologin -r -d %{_datadir}/%{name} jabber 2> /dev/null || :
# Add jabber group
/usr/sbin/groupadd jabber
exit 0

%post
chown -R jabber:jabber %{_var}/jabberd
/sbin/chkconfig --add jabberd
exit 0

%preun
if [ $1 = 0 ]; then
  /sbin/service jabberd stop > /dev/null 2>&1
/  sbin/chkconfig --del jabberd
fi

%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
%config %{_sysconfdir}/init.d/%{name}
%{_bindir}
%{_mandir}/man8/*
%doc

%attr (-,jabber,jabber) %{_var}/%{name}

%changelog
* Wed Jul 28 2004 Colin Walters <walters at redhat.com> 2.0s3-1
- Update to s3
- Always enable PAM
- Always enable SSL
- Mark config files as noreplace (!!)
- Fix chown to use :
- Add name for jabberd user and set shell to /sbin/nologin
- Disable idn for now

* Sat Jun 19 2004 Colin Walters <walters at redhat.com> 2.0s1-1
- Update to 2.0s1-1 

* Wed Aug 20 2003 <Matthew_Rich at playstation.sony.com>
- Initial build.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20040922/52a8eac1/attachment.sig>


More information about the fedora-devel-list mailing list