%global pkg_name openfire %global pkg_version 4.7.2 %global pkg_release 1 %global pkg_summary Openfire XMPP Server %global pkg_group Applications/Communications %global pkg_license Apache v2.0 %global pkg_uri https://www.igniterealtime.org/projects/openfire/index.jsp %global pkg_dwnl_uri https://codeload.github.com/igniterealtime/Openfire %global pkg_source openfire-%{pkg_version}.tar.gz %global app_name openfire %global app_user openfire %global app_group %{app_user} %global app_libdir %{_javadir}/%{app_name} %global app_datadir %{_datadir}/%{app_name} %global app_confdir %{_sysconfdir}/%{app_name} %global app_logdir %{_localstatedir}/log/%{app_name} # couldn't find another way to disable the brp-java-repack-jars which was called in __os_install_post %define __os_install_post %{nil} %define debug_package %{nil} # libshaj.so is included in the noarch build, so we disable the error about this %define _binaries_in_noarch_packages_terminate_build 0 Summary: %{pkg_summary} Name: %{pkg_name} Version: %{pkg_version} Release: %{pkg_release} Group: %{pkg_group} License: %{pkg_license} Url: %{pkg_uri} BuildArch: noarch BuildRequires: %{_bindir}/make BuildRequires: systemd BuildRequires: wget %if 0%{?fedora} || 0%{?rhel} >= 8 BuildRequires: maven >= 3.5.0 %else BuildRequires: java-1.11.0-openjdk-devel %endif Requires: java-1.11.0-headless Requires: systemd Source0: %{pkg_dlwnl_uri}/tar.gz/refs/tags/v%{pkg_version}#/%{pkg_source} Source1: %{app_name}.service Source2: %{app_name}-plugins-extra.wget %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. # TODO: split each plugin into it our package %package plugins-extra Summary: Extra plugins for Openfire Requires: %{name} >= %{version} %description plugins-extra Extra plugins for Openfire. This package provides all extra plugins available for Openfire. %prep %setup -q -n Openfire-%{pkg_version} cp xmppserver/{README,LICENSE,changelog}.html . sed -i -e 's,@@APP_DATADIR@@,%{app_datadir},g' %{SOURCE1} sed -i -e 's,@@APP_LIBDIR@@,%{app_libdir},g' %{SOURCE1} # Download extra plugins mkdir -p plugins-extra && cd $_ wget -ci %{SOURCE2} || : cd - %build make pushd distribution/target cp -r distribution-base %{_builddir}/%{app_name} popd mv plugins-extra %{_builddir}/%{app_name}/ %install rm -rf %{buildroot} # Create the filesystem hierarchy install -dm755 %{buildroot}%{_bindir} install -dm755 %{buildroot}%{app_libdir} install -dm755 %{buildroot}%{app_datadir}/bin install -dm755 %{buildroot}%{app_datadir}/plugins install -dm755 %{buildroot}%{app_datadir}/plugins-extra install -dm755 %{buildroot}%{app_datadir}/resources install -dm750 %{buildroot}%{app_confdir} install -dm750 %{buildroot}%{app_logdir} ln -s %{app_confdir} %{buildroot}%{app_datadir}/conf ln -s %{app_libdir} %{buildroot}%{app_datadir}/lib ln -s %{app_logdir} %{buildroot}%{app_datadir}/logs # Install the files pushd %{_builddir}/%{app_name} cp -R bin/* %{buildroot}%{app_datadir}/bin/ cp -R lib/* %{buildroot}%{app_libdir}/ cp -R plugins/* %{buildroot}%{app_datadir}/plugins/ cp -R plugins-extra/* %{buildroot}%{app_datadir}/plugins-extra/ cp -R resources/* %{buildroot}%{app_datadir}/resources/ cp -R conf/* %{buildroot}%{app_confdir}/ popd # Move over the embedded db viewer pieces mv %{buildroot}%{app_datadir}/bin/extra/embedded-db.rc %{buildroot}%{app_datadir}/bin/ mv %{buildroot}%{app_datadir}/bin/extra/embedded-db-viewer.sh %{buildroot}%{app_datadir}/bin/ # Maintain security resources in a separated directory mv %{buildroot}%{app_datadir}/resources/security %{buildroot}%{app_confdir}/ ln -s %{app_confdir}/security %{buildroot}%{app_datadir}/resources/security # Install systemd service install -Dm644 %{SOURCE1} %{buildroot}%{_unitdir}/%{app_name}.service # We don't really need any of these things. rm -rf %{buildroot}%{app_datadir}/bin/extra rm -f %{buildroot}%{app_datadir}/bin/*.bat rm -rf %{buildroot}%{app_datadir}/resources/nativeAuth/osx-ppc rm -rf %{buildroot}%{app_datadir}/resources/nativeAuth/win32-x86 rm -rf %{buildroot}%{app_datadir}/resources/nativeAuth/ rm -f %{buildroot}%{app_libdir}/*.dll rm -f %{buildroot}%{app_confdir}/openfire-demoboot.xml %clean rm -rf %{buildroot} %preun if [ "$1" == "0" ]; then # This is an uninstall, instead of an upgrade. [ -f %{_unitdir}/%{app_name}.service ] && \ (systemctl stop %{app_name}; systemctl disable %{app_name}) [ 0`id -u %{app_user} 2>/dev/null` -lt 1000 ] && userdel %{app_user} fi # Force a happy exit even if openfire shutdown script didn't exit cleanly. exit 0 %post if [ "$1" == "1" ]; then # This is a fresh install, instead of an upgrade. if [ "`id -un %{app_user} 2>/dev/null`" != "%{app_user}" ]; then [ ! 0`id -u %{app_user} 2>/dev/null` -gt 1000 ] && \ adduser -d %{app_datadir} -s /sbin/nologin -r %{app_user} fi systemctl enable %{app_name} fi chown -R %{app_user}:%{app_group} %{app_datadir} %{app_confdir} %{app_logdir} # Trigger a restart. [ -f %{_unitdir}/%{app_name}.service ] && systemctl condrestart %{app_name} # Force a happy exit even if openfire condrestart script didn't exit cleanly. exit 0 %files %defattr(-,root,root,-) %doc LICENSE.* README.* changelog.html %dir %{app_confdir} %config(noreplace) %{app_confdir}/openfire.xml %config(noreplace) %{app_confdir}/security.xml %config(noreplace) %{app_confdir}/crowd.properties %dir %{app_confdir}/security %config(noreplace) %{app_confdir}/security/keystore %config(noreplace) %{app_confdir}/security/truststore %config(noreplace) %{app_confdir}/security/client.truststore %{app_confdir}/security/* %{app_datadir}/* %{app_libdir}/* %ghost %dir %{app_logdir} %{_unitdir}/%{app_name}.service %files plugins-extra %dir %{app_datadir}/plugins-extra %{app_datadir}/plugins-extra/* %changelog * Tue Jul 19 2022 Christian.tosta 4.7.2-1 - updated to 4.7.2 - updated openjdk dependency to version 11 - updated/added plugins * Fri Dec 04 2020 Christian.tosta 4.6.0-1 - updated to 4.6.0 * Sat May 16 2020 Christian.tosta 4.5.1-1 - updated to 4.5.1 * Tue Aug 21 2018 Christian.tosta 4.2.3-1 - updated to 4.2.3 * Tue Feb 20 2018 Christian.tosta 4.2.2-1 - updated to 4.2.2 * Mon Dec 11 2017 Christian.tosta 4.2.1-1 - updated to 4.2.1 * Fri Dec 08 2017 Christian.tosta 4.2.0-1 - updated to 4.2.0 * Thu Oct 19 2017 Christian Tosta 4.1.6-1 - updated to 4.1.6 * Fri Jun 02 2017 Christian Tosta 4.1.4-1 - udpated to 4.1.4 * Wed Sep 23 2015 Christian Tosta 3.10.2-2 - updated to 3.10.2 * Wed Jan 21 2015 Christian Tosta 3.9.3-1 - First build for CentOS 7.