File sipx-openfire.spec of Package sipx-openfire

#!BuildIgnore: post-build-checks
Summary: Openfire XMPP Server
Name: sipx-openfire
Version: 3.6.4
Release: 2
BuildRoot: %{_builddir}/%{name}-root
Source0: sipx-openfire-%version.tar.gz
Group: Applications/Communications
Vendor: Jive Software
Packager: SIPfoundry (
License: GPL
AutoReqProv: no

%if %{_vendor} == redhat
BuildRequires: shadow-utils
%if %{_vendor} == suse
BuildRequires: pwdutils
BuildRequires: unzip
BuildRequires: java-devel >= 1.6

# unpack200 used during install comes with java-devel package
Requires: java-devel >= 1.6
Requires: sipx-kraken

Obsoletes: openfire

%define prefix /opt
%define homedir %{prefix}/openfire

This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
( Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.

Openfire is a leading Open Source, cross-platform IM server based on the
XMPP (Jabber) protocol. It has great performance, is easy to setup and use,
and delivers an innovative feature set.

%setup -qcn %name-%version


mkdir -p -m 755 $RPM_BUILD_ROOT%{homedir}
tar -xzf openfire_3_6_4.tar.gz -C $RPM_BUILD_ROOT%{prefix}


# If there is no daemon user, create it.
# Red Hat's useradd command adds the group automatically,
# but SUSE does not.
# The -f option means to create the group only if it does not already exist.
/usr/sbin/groupadd -f sipxchange || :
if ! id -u sipxchange > /dev/null 2>&1 ; then
   /usr/sbin/useradd \
       -c "sipX service daemon" \
       -d %{_sysconfdir}/sipxpbx \
       -s /bin/bash \
       -g sipxchange \
       sipxchange > /dev/null 2>&1 || :

# Unpack any packed jar files.
%if %{_vendor} == suse
  for packed_jar in /opt/openfire/lib/*.jar.pack; do \
	jar=${packed_jar%.pack}; \
	/usr/bin/unpack200 -r $packed_jar $jar; \
	chown sipxchange:sipxchange $jar; \
  for packed_jar in /opt/openfire/lib/*.jar.pack; do \
	jar=${packed_jar%.pack}; \
	unpack200 -r $packed_jar $jar; \
	chown sipxchange:sipxchange $jar; \

%attr(775,sipxchange,sipxchange) %dir %{homedir}
%attr(-,sipxchange,sipxchange) %{homedir}/*
%dir %attr(755,sipxchange,sipxchange) %{homedir}/.install4j
%attr(-,sipxchange,sipxchange) %{homedir}/.install4j/*