|
| 1 | +%define mod_name log_gelf |
| 2 | +%define apxs %{_sbindir}/apxs |
| 3 | +Summary: Apache2 module for writing access logs to Graylog |
| 4 | +Name: apache-mod_%{mod_name} |
| 5 | +Version: 0.2.0 |
| 6 | +Release: 1 |
| 7 | +License: Apache v2.0 |
| 8 | +Group: Networking/Daemons/HTTP |
| 9 | +Source0: https://github.com/graylog-labs/apache-mod_log_gelf/archive/%{version}/%{name}-%{version}.tar.gz |
| 10 | +# Source0-md5: 4aba4fd0f8e1175c39d4ac236282df10 |
| 11 | +Source1: apache.conf |
| 12 | +URL: https://github.com/graylog-labs/apache-mod_log_gelf |
| 13 | +BuildRequires: %{apxs} |
| 14 | +BuildRequires: apache-devel >= 2.2 |
| 15 | +BuildRequires: rpmbuild(macros) >= 1.268 |
| 16 | +Requires: apache(modules-api) = %apache_modules_api |
| 17 | +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
| 18 | + |
| 19 | +%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) |
| 20 | +%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d |
| 21 | + |
| 22 | +%description |
| 23 | +Apache2 module for writing access logs to Graylog. |
| 24 | + |
| 25 | +%prep |
| 26 | +%setup -q -n apache-mod_log_gelf-%{version} |
| 27 | + |
| 28 | +%build |
| 29 | +%{__make} -C src |
| 30 | + |
| 31 | +%install |
| 32 | +rm -rf $RPM_BUILD_ROOT |
| 33 | +install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} |
| 34 | +%{__make} -C src install \ |
| 35 | + DESTDIR=$RPM_BUILD_ROOT |
| 36 | + |
| 37 | +cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf |
| 38 | + |
| 39 | +%clean |
| 40 | +rm -rf $RPM_BUILD_ROOT |
| 41 | + |
| 42 | +%post |
| 43 | +%service -q httpd restart |
| 44 | + |
| 45 | +%postun |
| 46 | +if [ "$1" = "0" ]; then |
| 47 | + %service -q httpd restart |
| 48 | +fi |
| 49 | + |
| 50 | +%files |
| 51 | +%defattr(644,root,root,755) |
| 52 | +%doc README.md |
| 53 | +%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
| 54 | +%attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
0 commit comments