File openfire.spec of Package openfire

#
# spec file for package openfire
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define         prefix /usr/share
%define         homedir %{prefix}/openfire

Summary:        Openfire XMPP Server
Name:           openfire
Version:        5.0.2
Release:        0
License:        Apache-2.0
Group:          Productivity/Networking/Talk/Servers
URL:            https://www.igniterealtime.org/
Source0:        https://github.com/igniterealtime/Openfire/releases/download/v%{version}/openfire-%{version}-1.noarch.rpm
Source1:        %{name}.service
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         coreutils
PreReq:         diffutils
PreReq:         fillup
PreReq:         grep
PreReq:         sed
BuildRequires:  build
BuildRequires:  fdupes
BuildRequires:  systemd
Requires:       java = 17

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

%package doc
Summary:        Openfire XMPP Server Documentation
Group:          Documentation/Other
License:        GPL-2.0-only

%description doc
This package contains optional documentation provided in addition to
this package's base documentation.

%prep
unrpm %{SOURCE0}

%build

%install
export NO_BRP_CHECK_BYTECODE_VERSION=true

# Prep the install location.
mkdir -p $RPM_BUILD_ROOT%{prefix}

# Copy over the main install tree.
chmod 644 opt/openfire/plugins/admin/webapp/style/framework/css/*.css opt/openfire/plugins/admin/webapp/style/framework/fonts/*.svg
mv opt/openfire/*.html opt/openfire/documentation .
cp -R opt/openfire $RPM_BUILD_ROOT%{homedir}

# systemd
mkdir -p %{buildroot}%{_sbindir}
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}

%pre %service_add_pre openfire.service

%preun %service_del_preun openfire.service

%post %service_add_post openfire.service

%postun %service_del_postun openfire.service

%files
%defattr(-,daemon,daemon)
%attr(750, daemon, daemon) %dir %{homedir}
%config(noreplace) %{homedir}/bin/embedded-db.rc
%{homedir}/bin/embedded-db-viewer.sh
%exclude %{homedir}/bin
%exclude %{homedir}/bin/openfire.sh
%exclude %{homedir}/bin/openfirectl
%dir %{homedir}/conf
%config(noreplace) %{homedir}/conf/openfire.xml
%config(noreplace) %{homedir}/conf/crowd.properties
%config(noreplace) %{homedir}/conf/security.xml
%dir %{homedir}/lib
%{homedir}/lib/*.jar
%{homedir}/lib/log4j2.xml
%dir %{homedir}/logs
%dir %{homedir}/plugins
%{homedir}/plugins/search.jar
%dir %{homedir}/plugins/admin
%{homedir}/plugins/admin/*
%dir %{homedir}/resources
%dir %{homedir}/resources/database
%{homedir}/resources/database/*.sql
%dir %{homedir}/resources/database/upgrade
%dir %{homedir}/resources/database/upgrade/*
%{homedir}/resources/database/upgrade/*/*
%dir %{homedir}/resources/nativeAuth
%dir %{homedir}/resources/nativeAuth/linux-i386
%{homedir}/resources/nativeAuth/linux-i386/*
%dir %{homedir}/resources/security
%config(noreplace) %{homedir}/resources/security/keystore
%config(noreplace) %{homedir}/resources/security/truststore
%config(noreplace) %{homedir}/resources/security/client.truststore
%config(noreplace) %{homedir}/resources/security/java.security
%dir %{homedir}/resources/security/archive
%{homedir}/resources/security/archive/readme.txt
%dir %{homedir}/resources/spank
%dir %{homedir}/resources/spank/WEB-INF
%{homedir}/resources/spank/WEB-INF/web.xml
%{homedir}/resources/spank/index.html
%{_sbindir}/rc%{name}
%{_unitdir}/%{name}.service
 /usr/share/openfire/resources/security/java.security

%files doc
%defattr(-,root,root)
%doc documentation LICENSE.html README.html changelog.html

%changelog
openSUSE Build Service is sponsored by