]>
Commit | Line | Data |
---|---|---|
27124d3b ER |
1 | # TODO |
2 | # - selinux_variants macro missing. something from fedora? | |
3 | # | |
4 | # Conditional build: | |
5 | %bcond_with selinux # build with selinu | |
fe3eda58 | 6 | |
27124d3b ER |
7 | %define subver .a1 |
8 | %define rel 0.1 | |
fe3eda58 | 9 | |
10 | Summary: 389 Directory Server (base) | |
11 | Name: 389-ds-base | |
12 | Version: 1.2.6 | |
27124d3b ER |
13 | Release: 0%{?subver}.%{rel} |
14 | License: GPL v2 with exceptions | |
fe3eda58 | 15 | Group: Daemons |
16 | URL: http://directory.fedoraproject.org/ | |
27124d3b ER |
17 | Source0: http://directory.fedoraproject.org/sources/%{name}-%{version}%{subver}.tar.bz2 |
18 | # Source0-md5: aa9299aa66b09f89ed80dd0cfeebde55 | |
fe3eda58 | 19 | BuildRequires: cyrus-sasl-devel |
20 | BuildRequires: db4.5-devel | |
21 | BuildRequires: icu | |
22 | BuildRequires: libicu-devel | |
23 | BuildRequires: libnl-devel | |
24 | BuildRequires: mozldap-devel | |
25 | BuildRequires: nspr-devel | |
26 | BuildRequires: nss-devel | |
27 | BuildRequires: pcre-devel | |
28 | BuildRequires: svrcore-devel | |
27124d3b | 29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
fe3eda58 | 30 | # The following are needed to build the snmp ldap-agent |
31 | BuildRequires: net-snmp-devel | |
32 | %ifnarch sparc sparc64 ppc ppc64 s390 s390x | |
33 | BuildRequires: lm_sensors-devel | |
34 | %endif | |
35 | BuildRequires: bzip2-devel | |
36 | BuildRequires: openssl-devel | |
37 | BuildRequires: tcp_wrappers | |
38 | BuildRequires: zlib-devel | |
39 | # The following are needed to build the SELinux policy | |
27124d3b ER |
40 | %if %{with selinux} |
41 | BuildRequires: checkpolicy | |
42 | BuildRequires: policycoreutils | |
43 | %endif | |
fe3eda58 | 44 | # the following is for the pam passthru auth plug-in |
45 | BuildRequires: pam-devel | |
fe3eda58 | 46 | # the following are needed for some of our scripts |
47 | Requires: mozldap-tools | |
48 | Requires: perl-Mozilla-LDAP | |
fe3eda58 | 49 | # this is needed to setup SSL if you are not using the |
50 | # administration server package | |
51 | Requires: nss-tools | |
fe3eda58 | 52 | # these are not found by the auto-dependency method |
53 | # they are required to support the mandatory LDAP SASL mechs | |
fe3eda58 | 54 | Requires: cyrus-sasl-digest-md5 |
27124d3b | 55 | Requires: cyrus-sasl-gssapi |
fe3eda58 | 56 | # this is needed for verify-db.pl |
27124d3b | 57 | Requires: db-utils |
fe3eda58 | 58 | # for the init script |
59 | Requires(post): /sbin/chkconfig | |
60 | Requires(preun): /sbin/chkconfig | |
61 | Requires(preun): /sbin/service | |
62 | ||
fe3eda58 | 63 | %description |
64 | 389 Directory Server is an LDAPv3 compliant server. The base package | |
65 | includes the LDAP server and command line utilities for server | |
66 | administration. | |
67 | ||
68 | %package devel | |
69 | Summary: Development libraries for 389 Directory Server | |
70 | Group: Development/Libraries | |
71 | Requires: %{name} = %{version}-%{release} | |
72 | Requires: mozldap-devel | |
73 | ||
74 | %description devel | |
75 | Development Libraries and headers for the 389 Directory Server base | |
76 | package. | |
77 | ||
27124d3b | 78 | %package selinux |
fe3eda58 | 79 | Summary: SELinux policy for 389 Directory Server |
80 | Group: Daemons | |
81 | Requires: %{name} = %{version}-%{release} | |
82 | Requires: selinux-policy | |
83 | ||
27124d3b | 84 | %description selinux |
fe3eda58 | 85 | SELinux policy for the 389 Directory Server base package. |
86 | ||
27124d3b | 87 | %package selinux-devel |
fe3eda58 | 88 | Summary: Development interface for 389 Directory Server base SELinux policy |
89 | Group: Development/Libraries | |
90 | ||
27124d3b | 91 | %description selinux-devel |
fe3eda58 | 92 | SELinux policy interface for the 389 Directory Server base package. |
fe3eda58 | 93 | |
fe3eda58 | 94 | %prep |
27124d3b | 95 | %setup -q -n %{name}-%{version}%{?subver} |
fe3eda58 | 96 | |
97 | %build | |
98 | %configure \ | |
99 | --enable-autobind \ | |
100 | --without-kerberos \ | |
27124d3b | 101 | %{?with_selinux:--with-selinux} |
fe3eda58 | 102 | |
103 | # Generate symbolic info for debuggers | |
27124d3b | 104 | export XCFLAGS="%{rpmcflags}" |
fe3eda58 | 105 | |
106 | %ifarch x86_64 ppc64 ia64 s390x sparc64 | |
107 | export USE_64=1 | |
108 | %endif | |
109 | ||
27124d3b | 110 | %{__make} |
fe3eda58 | 111 | |
27124d3b | 112 | %if %{with selinux} |
fe3eda58 | 113 | # Build the SELinux policy module for each variant |
114 | cd selinux-built | |
27124d3b ER |
115 | for selinuxvariant in %{selinux_variants}; do |
116 | %{__make} NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile | |
117 | mv dirsrv.pp dirsrv.pp.${selinuxvariant} | |
118 | %{__make} NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean | |
fe3eda58 | 119 | done |
120 | cd - | |
121 | %endif | |
122 | ||
123 | %install | |
124 | rm -rf $RPM_BUILD_ROOT | |
125 | ||
27124d3b ER |
126 | %{__make} install \ |
127 | DESTDIR=$RPM_BUILD_ROOT | |
fe3eda58 | 128 | |
129 | install -d $RPM_BUILD_ROOT/var/log/dirsrv | |
130 | install -d $RPM_BUILD_ROOT/var/lib/dirsrv | |
131 | install -d $RPM_BUILD_ROOT/var/lock/dirsrv | |
132 | install -d $RPM_BUILD_ROOT%{_includedir}/dirsrv | |
133 | ||
27124d3b | 134 | # remove libtool and static libs |
fe3eda58 | 135 | rm -f $RPM_BUILD_ROOT%{_libdir}/dirsrv/*.a |
136 | rm -f $RPM_BUILD_ROOT%{_libdir}/dirsrv/*.la | |
137 | rm -f $RPM_BUILD_ROOT%{_libdir}/dirsrv/plugins/*.a | |
138 | rm -f $RPM_BUILD_ROOT%{_libdir}/dirsrv/plugins/*.la | |
139 | ||
140 | install -p ldap/servers/slapd/slapi-plugin.h $RPM_BUILD_ROOT%{_includedir}/dirsrv/ | |
141 | install -p ldap/servers/plugins/replication/winsync-plugin.h $RPM_BUILD_ROOT%{_includedir}/dirsrv/ | |
142 | ||
143 | # make sure perl scripts have a proper shebang | |
144 | sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/dirsrv/script-templates/template-*.pl | |
145 | ||
27124d3b | 146 | %if %{with selinux} |
fe3eda58 | 147 | # Install the SELinux policy |
148 | cd selinux-built | |
27124d3b ER |
149 | for selinuxvariant in %{selinux_variants}; do |
150 | install -d $RPM_BUILD_ROOT%{_datadir}/selinux/${selinuxvariant} | |
151 | install -p -m 644 dirsrv.pp.${selinuxvariant} \ | |
152 | $RPM_BUILD_ROOT%{_datadir}/selinux/${selinuxvariant}/dirsrv.pp | |
fe3eda58 | 153 | done |
154 | cd - | |
155 | ||
156 | # Install the SELinux policy interface | |
157 | cd selinux-built | |
158 | install -d $RPM_BUILD_ROOT%{_datadir}/dirsrv-selinux | |
159 | install -p dirsrv.if $RPM_BUILD_ROOT%{_datadir}/dirsrv-selinux/dirsrv.if | |
160 | install -p dirsrv.te $RPM_BUILD_ROOT%{_datadir}/dirsrv-selinux/dirsrv.te | |
161 | install -p dirsrv.fc $RPM_BUILD_ROOT%{_datadir}/dirsrv-selinux/dirsrv.fc | |
162 | cd - | |
163 | %endif | |
164 | ||
165 | %clean | |
166 | rm -rf $RPM_BUILD_ROOT | |
167 | ||
168 | %post | |
fe3eda58 | 169 | /sbin/ldconfig |
27124d3b | 170 | /sbin/chkconfig --add dirsrv |
fe3eda58 | 171 | /sbin/chkconfig --add dirsrv-snmp |
172 | if [ ! -e %{_localstatedir}/run/dirsrv ]; then | |
27124d3b | 173 | mkdir %{_localstatedir}/run/dirsrv |
36e6ee8d | 174 | fi |
fe3eda58 | 175 | |
176 | %preun | |
27124d3b ER |
177 | if [ "$1" = 0 ]; then |
178 | %service dirsrv stop | |
179 | /sbin/chkconfig --del dirsrv | |
180 | %service dirsrv-snmp stop | |
181 | /sbin/chkconfig --del dirsrv-snmp | |
fe3eda58 | 182 | fi |
183 | ||
184 | %postun -p /sbin/ldconfig | |
185 | ||
fe3eda58 | 186 | %post selinux |
187 | if [ "$1" -le "1" ] ; then # First install | |
27124d3b ER |
188 | for selinuxvariant in %{selinux_variants}; do |
189 | semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/dirsrv.pp 2>/dev/null || : | |
190 | done | |
191 | fixfiles -R %{name} restore || : | |
192 | /sbin/service dirsrv condrestart > /dev/null 2>&1 || : | |
193 | /sbin/service dirsrv-snmp condrestart > /dev/null 2>&1 || : | |
fe3eda58 | 194 | fi |
195 | ||
196 | %preun selinux | |
197 | if [ "$1" -lt "1" ]; then # Final removal | |
27124d3b ER |
198 | for selinuxvariant in %{selinux_variants}; do |
199 | semodule -s ${selinuxvariant} -r dirsrv 2>/dev/null || : | |
200 | done | |
201 | fixfiles -R %{name} restore || : | |
202 | %service dirsrv condrestart > /dev/null 2>&1 || : | |
203 | %service dirsrv-snmp condrestart > /dev/null 2>&1 || : | |
fe3eda58 | 204 | fi |
205 | ||
206 | %postun selinux | |
207 | if [ "$1" -ge "1" ]; then # Upgrade | |
27124d3b ER |
208 | for selinuxvariant in %{selinux_variants}; do |
209 | semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/dirsrv.pp 2>/dev/null || : | |
210 | done | |
fe3eda58 | 211 | fi |
fe3eda58 | 212 | |
213 | %files | |
214 | %defattr(644,root,root,755) | |
215 | %doc LICENSE EXCEPTION LICENSE.GPLv2 | |
216 | %dir %{_sysconfdir}/dirsrv | |
217 | %dir %{_sysconfdir}/dirsrv/schema | |
fe3eda58 | 218 | %dir %{_sysconfdir}/dirsrv/config |
27124d3b ER |
219 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dirsrv/schema/*.ldif |
220 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dirsrv/config/slapd-collations.conf | |
221 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dirsrv/config/certmap.conf | |
222 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dirsrv/config/ldap-agent.conf | |
223 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dirsrv/config/template-initconfig | |
224 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/dirsrv | |
fe3eda58 | 225 | %{_datadir}/dirsrv |
226 | %attr(754,root,root) /etc/rc.d/init.d/dirsrv | |
227 | %attr(754,root,root) /etc/rc.d/init.d/dirsrv-snmp | |
228 | %attr(755,root,root) %{_bindir}/* | |
229 | %attr(755,root,root) %{_sbindir}/* | |
230 | %dir %{_libdir}/dirsrv | |
231 | %attr(755,root,root) %{_libdir}/dirsrv/*.so.* | |
232 | %{_libdir}/dirsrv/perl | |
233 | %dir %{_libdir}/dirsrv/plugins | |
234 | %{_libdir}/dirsrv/plugins/*.so | |
235 | %dir %{_localstatedir}/lib/dirsrv | |
236 | %dir %{_localstatedir}/log/dirsrv | |
237 | %dir %{_localstatedir}/lock/dirsrv | |
238 | %{_mandir}/man1/* | |
239 | %{_mandir}/man8/* | |
240 | ||
241 | %files devel | |
242 | %defattr(644,root,root,755) | |
243 | %{_includedir}/dirsrv | |
244 | %{_libdir}/dirsrv/*.so | |
245 | ||
27124d3b | 246 | %if %{with selinux} |
fe3eda58 | 247 | %files selinux |
248 | %defattr(644,root,root,755) | |
249 | %{_datadir}/selinux/*/dirsrv.pp | |
250 | ||
251 | %files selinux-devel | |
252 | %defattr(644,root,root,755) | |
253 | %{_datadir}/dirsrv-selinux | |
fe3eda58 | 254 | %endif |