# Set bundled to copy needed jars to lib dir to run on a non-Fedora system. %bcond_with bundled # Set hsqldb to use hsqldb instead of h2 for local database %bcond_with hsqldb # Enable Sentry logging plugin (http://sentry.io) - proprietary jar needed. %bcond_with sentry # Enable tests at build time. # Tests require mockito >= 2.6.8 and localhost networking. %bcond_with tests %global openas2dir %{_sharedstatedir}/%{name} %if %{with tests} %global skip_test '' %else %global skip_test -Dmaven.test.skip=true %endif Name: openas2 Version: 2.6.1 Release: 4%{?dist} Summary: Java-based implementation of the EDIINT AS2 standard License: BSD URL: https://github.com/OpenAS2/OpenAs2App Source0: https://github.com/OpenAS2/OpenAs2App/archive/v%{version}.tar.gz#/OpenAs2App-%{version}.tar.gz %if %{with hsqldb} # Use hsqldb instead of h2 for embedded database. # # Pre-created hsqldb database. FIXME: this should be loaded from db_ddl.sql Source1: hsqldb.tar # Code changes to use hsqldb Patch0: openas2-hsqldb.patch %endif # org.osgi.framework.ServiceRegistration does take a template parameter Patch2: openas2-osgi.patch # Use OPENAS2_BASE since start script can't be in /var/lib Patch3: openas2-fedora.patch # openas2.service modified for this package's file layout Source2: openas2.service # Logrotate to delete old logs (openas2 rotates on its own) Source3: openas2.logrotate BuildRequires: maven-local dom4j javamail bouncycastle glassfish-servlet-api BuildRequires: findbugs hamcrest sonatype-oss-parent dos2unix %if %{with hsqldb} BuildRequires: hsqldb-lib %else BuildRequires: mvn(com.h2database:h2) %endif BuildRequires: bouncycastle-mail bouncycastle-pkix bouncycastle-pg BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin) BuildRequires: mvn(org.mockito:mockito-all) BuildRequires: mvn(org.osgi:org.osgi.core) %if 0 # FIXME: adding to try to make unit tests work in mock BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-toolchains-plugin) BuildRequires: mvn(org.apache.maven:maven-toolchain) BuildRequires: mvn(org.apache.felix:org.osgi.foundation) BuildRequires: mvn(org.apache.felix:org.osgi.compendium) BuildRequires: mvn(org.osgi:org.osgi.annotation) BuildRequires: mvn(org.osgi:org.osgi.compendium) BuildRequires: mvn(org.apache.commons:commons-dbcp) BuildRequires: mvn(org.apache.commons:commons-pool) %endif # BuildRequires: systemd BuildArch: noarch Requires: java >= 1.8 %description OpenAS2 is a java-based implementation of the EDIINT AS2 standard. It is intended to be used as a server. It is extremely configurable and supports a wide variety of signing and encryption algorithms. This base package contains libraries and documentation. %package server Summary: Preconfigured OpenAS2 server application BuildArch: noarch Requires: systemd Requires: %{name} = %{version}-%{release} %{?systemd_requires} %description server %if %{with hsqldb} A mostly preconfigured openas2 server, using hsqldb by default for a %else A mostly preconfigured openas2 server, using h2 by default for a %endif standalone package. It can be configured to use postgresql instead. %package javadoc Summary: OpenAS2 API documentation %description javadoc API documentation for OpenAS2 %prep %setup -qn OpenAs2App-%{version} %if %{with hsqldb} %patch0 -b .hsqldb %endif %patch2 -b .osgi %patch3 -b .fedora %if %{with hsqldb} %pom_remove_dep com.h2database: Server %pom_add_dep org.hsqldb:hsqldb:%{version} Server %endif %if !%{with sentry} %pom_remove_dep io.sentry: Server %endif # Make submodule parents match actual parent %pom_set_parent net.sf.openas2:OpenAS2:%{version} Remote %pom_set_parent net.sf.openas2:OpenAS2:%{version} Bundle %if %{with hsqldb} # initial hsqldb database tar xvf %{SOURCE1} %endif # remove binaries that came with the "source" find . -name "*.jar" -delete # remove h2 preloaded databases find . -name "openas2.mv.db" -delete # rename SentryLogger when not enabled %if !%{with sentry} cd Server/src/main/java/org/openas2/logging mv SentryLogger.java SentryLogger.java.sentry cd - %endif # Fix DOS eol dos2unix changes.txt RELEASE-NOTES.md Remote/docs/Readme.txt %build %if %{with tests} %mvn_build -- -Dproject.build.sourceEncoding=UTF-8 %else %mvn_build -f -- -Dproject.build.sourceEncoding=UTF-8 %endif %install %mvn_install # systemd service mkdir -p %{buildroot}%{_unitdir} install -pm644 %{SOURCE2} %{buildroot}%{_unitdir} # server application runs from /var/lib/openas2 mkdir -p %{buildroot}%{openas2dir}/{bin,db,config} ln -sf %{_libexecdir}/%{name}/start-openas2.sh %{buildroot}%{openas2dir}/bin # spooled messages in /var/spool/openas2 mkdir -p %{buildroot}%{_var}/spool/openas2 ln -sf %{_var}/spool/%{name} %{buildroot}%{openas2dir}/data # logs in /var/log/openas2 mkdir -p %{buildroot}%{_localstatedir}/log/%{name} ln -sf %{_localstatedir}/log/%{name} %{buildroot}%{openas2dir}/logs # put scripts in /usr/libexec/openas2 mkdir -p %{buildroot}%{_libexecdir}/%{name} install -pm755 Server/target/dist/bin/start-openas2.sh \ %{buildroot}%{_libexecdir}/%{name} # symlink library jars to /usr/share/java cp -pr Server/target/dist/lib %{buildroot}%{openas2dir} %if !%{with bundled} xmvn-subst %{buildroot}%{openas2dir}/lib # replace system jars with symlinks %endif ln -sf %{_javadir}/openas2/openas2-server.jar \ %{buildroot}%{openas2dir}/lib/openas2-server* # sample configurations in /etc/openas2 mkdir -p %{buildroot}%{_sysconfdir}/%{name} cp -p Server/target/dist/config/*.* %{buildroot}%{_sysconfdir}/%{name} cd %{buildroot}%{_sysconfdir}/%{name} %if %{with hsqldb} # config.xml.hsqldb is the backup from the hsqldb patch mv config.xml.hsqldb config.xml.h2 %endif # symlink sample configurations to run dir where config expects them # QUESTION: should we modify the config to use absolute paths to # our run dir instead? for i in *.*; do ln -sf %{_sysconfdir}/%{name}/"$i" %{buildroot}%{openas2dir}/config done cd - # template h2/hsqldb database cp -pr Server/target/dist/config/DB %{buildroot}%{openas2dir}/config # logrotate config to delete old logs mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d cp -p %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}.logrotate %files -f .mfiles %license LICENSE.txt Remote/docs/license.txt %doc changes.txt README.md RELEASE-NOTES.md docs/* Remote/docs/Readme.txt %pre getent group openas2 > /dev/null || /usr/sbin/groupadd -r openas2 getent passwd openas2 > /dev/null || /usr/sbin/useradd -g openas2 \ -c "Java EDIINT AS2 Server" \ -r -d %{openas2dir} -s /sbin/nologin openas2 exit 0 %files javadoc %license LICENSE.txt %{_javadocdir}/* %files server %{_libexecdir}/%{name} %attr(0644,root,root) %{_unitdir}/* %attr(0755,root,root) %dir %{openas2dir} %attr(0755,root,root) %{openas2dir}/bin %attr(0755,root,root) %dir %{openas2dir}/lib %{openas2dir}/lib/* %attr(0755,root,root) %dir %{openas2dir}/config %{openas2dir}/config/* %attr(0750,root,openas2) %dir %{_sysconfdir}/%{name} %attr(0640,root,openas2) %config(noreplace) %{_sysconfdir}/%{name}/* %attr(0755,openas2,openas2) %dir %{openas2dir}/db %{openas2dir}/data %attr(0755,openas2,openas2) %dir %{_var}/spool/%{name} %{openas2dir}/logs %attr(0755,openas2,openas2) %dir %{_localstatedir}/log/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/* %post server %systemd_post %{name}.service %postun server %systemd_postun_with_restart %{name}.service %preun server %systemd_preun %{name}.service %changelog * Wed Sep 19 2018 Stuart D. Gathman 2.6.1-4 - Build on f29 * Fri Sep 14 2018 Stuart D. Gathman 2.6.1-3 - Some changes recommended by mizdebsk from #fedora-java - Use %%bcond_with - Remove /var/run/openas2, Provides - Add logrotate to delete old log files * Thu Sep 13 2018 Stuart D. Gathman 2.6.1-2 - Fix some rpmlint issues - Make hsqldb optional, since h2 is now sufficiently supported in Fedora * Thu Sep 13 2018 Stuart D. Gathman 2.6.1-1 - Update to 2.6.1 * Wed Aug 9 2017 Stuart D. Gathman 2.3.1-1 - Update to 2.3.1 - move data to /var/spool/openas2 - add flag to enable tests at build time - add flag to enable SentryLogger plugin * Wed Aug 9 2017 Stuart D. Gathman 2.3.0-7 - Make configs readable by openas2 only * Tue Aug 8 2017 Stuart D. Gathman 2.3.0-6 - Move logs to /var/log/openas2 * Mon Aug 7 2017 Stuart D. Gathman 2.3.0-5 - Add bundle option to allow installing binary rpms on EL7 - Move openas2-server configs to /etc/openas2 * Wed Aug 2 2017 Stuart D. Gathman 2.3.0-4 - hsqldb can't handle upper case dbdir - hsqldb puts lock file in working dir * Wed Aug 2 2017 Stuart D. Gathman 2.3.0-3 - /var/lib/openas2/bin cannot be symlink * Tue Aug 1 2017 Stuart D. Gathman 2.3.0-2 - start script cannot be in /var/lib * Tue Aug 1 2017 Stuart D. Gathman 2.3.0-1 - Initial rpm