2 # Available build options:
3 %bcond_with checkpath # enable check if php execution is within DOCUMENT_ROOT of the vhost
6 %define apxs /usr/sbin/apxs1
7 Summary: Apache module: suPHP - execute PHP scripts with the permissions of their owners
8 Summary(pl.UTF-8): Moduł do apache: suPHP - uruchamianie skryptów PHP z uprawnieniami ich właścicieli
9 Name: apache1-mod_%{mod_name}
13 Group: Networking/Daemons
14 Source0: http://www.suphp.org/download/%{mod_name}-%{version}.tar.gz
15 # Source0-md5: 337909e87027af124052baddddbd2994
17 Source2: %{name}.logrotate
18 URL: http://www.suphp.org/
19 BuildRequires: apache1-devel >= 1.3.33-2
20 BuildRequires: autoconf
21 BuildRequires: automake
22 Requires(triggerpostun): %{apxs}
23 Requires(triggerpostun): grep
24 Requires(triggerpostun): sed >= 4.0
27 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
30 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
33 suPHP is a tool for executing PHP scripts with the permissions of
34 their owners. It consists of an Apache module (mod_suphp) and a setuid
35 root binary (suphp) that is called by the Apache module to change the
36 uid of the process executing the PHP interpreter.
38 %description -l pl.UTF-8
39 suPHP jest narzędziem pozwalającym na wykonywanie skryptów w PHP z
40 uprawnieniami ich właścicieli. Składa się z modułu (mod_suphp) oraz
41 programu (suphp) z ustawionym bitem suid, który uruchamiany jest przez
42 moduł w celu zmiany uid procesu uruchamiającego interpreter PHP.
45 %setup -q -n %{mod_name}-%{version}
48 rm -f doc/{de,en}/LICENSE
49 # common Apache license
50 rm -f doc/{de,en}/apache/LICENSE
58 %{?with_checkpath: --enable-checkpath} \
59 %{!?with_checkpath: --disable-checkpath} \
60 --with-apache-user=http \
64 --with-php=/usr/bin/php.cgi \
71 rm -rf $RPM_BUILD_ROOT
72 install -d $RPM_BUILD_ROOT{%{_sbindir},%{_pkglibdir},%{_sysconfdir}/conf.d}
74 install src/suphp $RPM_BUILD_ROOT%{_sbindir}
75 install src/apache/mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
76 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
78 install -d $RPM_BUILD_ROOT/etc/logrotate.d
79 # TODO: apache1-mod_suphp + trigger
80 install %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/apache-mod_suphp
83 rm -rf $RPM_BUILD_ROOT
86 %service -q apache restart
89 if [ "$1" = "0" ]; then
90 %service -q apache restart
93 # TODO remove the trigger, if no longer needed
94 %triggerpostun -- %{name} <= 0.5.2-1
95 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
96 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
98 /^Include.*mod_%{mod_name}\.conf/d
99 ' /etc/apache/apache.conf
101 %service -q apache restart
105 %defattr(644,root,root,755)
106 %doc AUTHORS ChangeLog doc/en doc/de
107 %attr(4755,root,root) %{_sbindir}/suphp
108 %attr(755,root,root) %{_pkglibdir}/*
109 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/*
110 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf