1 |
spuhler |
296942 |
%define major 0 |
2 |
|
|
%define libname %mklibname 389-ds-base %major |
3 |
spuhler |
287129 |
|
4 |
spuhler |
296942 |
|
5 |
spuhler |
287129 |
%global pkgname dirsrv |
6 |
|
|
# for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release |
7 |
|
|
# also remove the space between % and global - this space is needed because |
8 |
|
|
# fedpkg verrel stupidly ignores comment lines |
9 |
spuhler |
291495 |
# % global prerel .a1 |
10 |
spuhler |
287129 |
# also need the relprefix field for a pre-release e.g. .0 - also comment out for official release |
11 |
spuhler |
291495 |
# %global relprefix 0. |
12 |
spuhler |
287129 |
|
13 |
spuhler |
291495 |
%global use_openldap 1 |
14 |
|
|
%global use_db4 0 |
15 |
|
|
# If perl-Socket-2.000 or newer is available, set 0 to use_Socket6. |
16 |
|
|
%global use_Socket6 0 |
17 |
spuhler |
287129 |
|
18 |
|
|
# fedora 15 and later uses tmpfiles.d |
19 |
|
|
# otherwise, comment this out |
20 |
|
|
#%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} |
21 |
|
|
|
22 |
spuhler |
291495 |
# systemd support |
23 |
|
|
%global groupname %{pkgname}.target |
24 |
|
|
|
25 |
spuhler |
287129 |
Summary: 389 Directory Server (base) |
26 |
|
|
Name: 389-ds-base |
27 |
spuhler |
291495 |
Version: 1.2.11.12 |
28 |
|
|
Release: %mkrel 1 |
29 |
spuhler |
287129 |
License: GPLv2 with exceptions |
30 |
|
|
URL: http://port389.org/ |
31 |
spuhler |
291509 |
Group: System/Servers |
32 |
spuhler |
287129 |
Obsoletes: %{name}-selinux |
33 |
spuhler |
291495 |
Conflicts: selinux-policy-base < 3.9.8 |
34 |
spuhler |
287129 |
Requires: %{name}-libs = %{version}-%{release} |
35 |
spuhler |
291495 |
Provides: ldif2ldbm |
36 |
spuhler |
287129 |
|
37 |
|
|
BuildRequires: nspr-devel |
38 |
|
|
BuildRequires: nss-devel |
39 |
spuhler |
300705 |
BuildRequires: krb5-devel |
40 |
spuhler |
287129 |
BuildRequires: svrcore-devel |
41 |
|
|
%if %{use_openldap} |
42 |
|
|
BuildRequires: openldap-devel |
43 |
|
|
%else |
44 |
|
|
BuildRequires: mozldap-devel |
45 |
|
|
%endif |
46 |
spuhler |
291495 |
%if %{use_db4} |
47 |
spuhler |
287129 |
BuildRequires: db4-devel |
48 |
spuhler |
291495 |
%else |
49 |
|
|
BuildRequires: db-devel |
50 |
|
|
%endif |
51 |
spuhler |
300646 |
BuildRequires: libsasl-devel |
52 |
spuhler |
287129 |
BuildRequires: icu |
53 |
|
|
BuildRequires: libicu-devel |
54 |
|
|
BuildRequires: pcre-devel |
55 |
spuhler |
291495 |
BuildRequires: gcc-c++ |
56 |
spuhler |
287129 |
# The following are needed to build the snmp ldap-agent |
57 |
|
|
BuildRequires: net-snmp-devel |
58 |
|
|
BuildRequires: bzip2-devel |
59 |
|
|
BuildRequires: zlib-devel |
60 |
|
|
BuildRequires: openssl-devel |
61 |
|
|
BuildRequires: tcp_wrappers |
62 |
|
|
# the following is for the pam passthru auth plug-in |
63 |
|
|
BuildRequires: pam-devel |
64 |
spuhler |
291495 |
BuildRequires: systemd-units |
65 |
spuhler |
287129 |
|
66 |
|
|
# this is needed for using semanage from our setup scripts |
67 |
spuhler |
291495 |
Requires: policycoreutils-python |
68 |
spuhler |
287129 |
|
69 |
|
|
# the following are needed for some of our scripts |
70 |
|
|
%if %{use_openldap} |
71 |
spuhler |
291495 |
Requires: openldap-clients |
72 |
spuhler |
287129 |
%else |
73 |
|
|
Requires: mozldap-tools |
74 |
|
|
%endif |
75 |
|
|
# use_openldap assumes perl-Mozilla-LDAP is built with openldap support |
76 |
|
|
Requires: perl-Mozilla-LDAP |
77 |
|
|
|
78 |
|
|
# this is needed to setup SSL if you are not using the |
79 |
|
|
# administration server package |
80 |
spuhler |
291495 |
Requires: nss |
81 |
spuhler |
287129 |
|
82 |
|
|
# these are not found by the auto-dependency method |
83 |
|
|
# they are required to support the mandatory LDAP SASL mechs |
84 |
spuhler |
300646 |
Requires: sasl-plug-gssapi |
85 |
|
|
Requires: sasl-plug-digestmd5 |
86 |
spuhler |
287129 |
|
87 |
|
|
# this is needed for verify-db.pl |
88 |
spuhler |
291495 |
%if %{use_db4} |
89 |
spuhler |
287129 |
Requires: db4-utils |
90 |
spuhler |
291495 |
%else |
91 |
spuhler |
296942 |
Requires: db5-utils |
92 |
spuhler |
291495 |
%endif |
93 |
spuhler |
287129 |
|
94 |
|
|
# This picks up libperl.so as a Requires, so we add this versioned one |
95 |
spuhler |
305248 |
#Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) |
96 |
spuhler |
287129 |
|
97 |
|
|
# for the init script |
98 |
spuhler |
291495 |
Requires(post): systemd-units |
99 |
|
|
Requires(preun): systemd-units |
100 |
|
|
Requires(postun): systemd-units |
101 |
spuhler |
287129 |
|
102 |
spuhler |
291495 |
# for setup-ds.pl to support ipv6 |
103 |
|
|
%if %{use_Socket6} |
104 |
|
|
Requires: perl-Socket6 |
105 |
|
|
%else |
106 |
|
|
Requires: perl-Socket |
107 |
|
|
%endif |
108 |
|
|
Requires: perl-NetAddr-IP |
109 |
|
|
|
110 |
spuhler |
287129 |
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2 |
111 |
|
|
# 389-ds-git.sh should be used to generate the source tarball from git |
112 |
|
|
Source1: %{name}-git.sh |
113 |
|
|
Source2: %{name}-devel.README |
114 |
|
|
|
115 |
|
|
%description |
116 |
|
|
389 Directory Server is an LDAPv3 compliant server. The base package includes |
117 |
|
|
the LDAP server and command line utilities for server administration. |
118 |
|
|
|
119 |
spuhler |
296942 |
%package -n %{libname} |
120 |
spuhler |
287129 |
Summary: Core libraries for 389 Directory Server |
121 |
spuhler |
291509 |
Group: System/Servers |
122 |
spuhler |
287129 |
BuildRequires: nspr-devel |
123 |
|
|
BuildRequires: nss-devel |
124 |
|
|
BuildRequires: svrcore-devel |
125 |
|
|
%if %{use_openldap} |
126 |
|
|
BuildRequires: openldap-devel |
127 |
|
|
%else |
128 |
|
|
BuildRequires: mozldap-devel |
129 |
|
|
%endif |
130 |
spuhler |
291495 |
%if %{use_db4} |
131 |
spuhler |
287129 |
BuildRequires: db4-devel |
132 |
spuhler |
291495 |
%else |
133 |
|
|
BuildRequires: db-devel |
134 |
|
|
%endif |
135 |
spuhler |
300646 |
BuildRequires: libsasl-devel |
136 |
spuhler |
287129 |
BuildRequires: libicu-devel |
137 |
|
|
BuildRequires: pcre-devel |
138 |
|
|
|
139 |
spuhler |
296942 |
%description -n %{libname} |
140 |
spuhler |
287129 |
Core libraries for the 389 Directory Server base package. These libraries |
141 |
|
|
are used by the main package and the -devel package. This allows the -devel |
142 |
|
|
package to be installed with just the -libs package and without the main package. |
143 |
|
|
|
144 |
|
|
%package devel |
145 |
|
|
Summary: Development libraries for 389 Directory Server |
146 |
spuhler |
296942 |
Group: System/Libraries |
147 |
spuhler |
287129 |
Requires: %{name}-libs = %{version}-%{release} |
148 |
|
|
Requires: pkgconfig |
149 |
|
|
Requires: nspr-devel |
150 |
|
|
Requires: nss-devel |
151 |
|
|
Requires: svrcore-devel |
152 |
|
|
%if %{use_openldap} |
153 |
|
|
Requires: openldap-devel |
154 |
|
|
%else |
155 |
|
|
Requires: mozldap-devel |
156 |
|
|
%endif |
157 |
|
|
|
158 |
|
|
%description devel |
159 |
|
|
Development Libraries and headers for the 389 Directory Server base package. |
160 |
|
|
|
161 |
|
|
%prep |
162 |
|
|
%setup -q -n %{name}-%{version}%{?prerel} |
163 |
|
|
cp %{SOURCE2} README.devel |
164 |
|
|
|
165 |
|
|
%build |
166 |
spuhler |
291495 |
autoreconf -fi |
167 |
spuhler |
287129 |
%if %{use_openldap} |
168 |
|
|
OPENLDAP_FLAG="--with-openldap" |
169 |
|
|
%endif |
170 |
spuhler |
305248 |
%configure2_5x --enable-autobind \ |
171 |
spuhler |
296942 |
--with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \ |
172 |
spuhler |
291495 |
--with-systemdsystemunitdir=%{_unitdir} \ |
173 |
|
|
--with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \ |
174 |
spuhler |
305248 |
--with-systemdgroupname=%{groupname} \ |
175 |
|
|
LDFLAGS=-L%{perl_archlib}/CORE |
176 |
spuhler |
287129 |
|
177 |
|
|
# Generate symbolic info for debuggers |
178 |
|
|
export XCFLAGS=$RPM_OPT_FLAGS |
179 |
|
|
|
180 |
spuhler |
305248 |
|
181 |
spuhler |
296942 |
%make |
182 |
spuhler |
287129 |
|
183 |
|
|
|
184 |
|
|
%install |
185 |
|
|
rm -rf $RPM_BUILD_ROOT |
186 |
|
|
|
187 |
|
|
make DESTDIR="$RPM_BUILD_ROOT" install |
188 |
|
|
|
189 |
|
|
mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname} |
190 |
|
|
mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname} |
191 |
|
|
mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname} |
192 |
|
|
|
193 |
spuhler |
291495 |
# for systemd |
194 |
|
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants |
195 |
|
|
|
196 |
spuhler |
287129 |
#remove libtool and static libs |
197 |
|
|
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.a |
198 |
|
|
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.la |
199 |
|
|
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.a |
200 |
|
|
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.la |
201 |
|
|
|
202 |
|
|
# make sure perl scripts have a proper shebang |
203 |
|
|
sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/script-templates/template-*.pl |
204 |
|
|
|
205 |
|
|
%clean |
206 |
|
|
rm -rf $RPM_BUILD_ROOT |
207 |
|
|
|
208 |
|
|
%post |
209 |
spuhler |
291495 |
# reload to pick up any changes to systemd files |
210 |
|
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || : |
211 |
|
|
# reload to pick up any shared lib changes |
212 |
spuhler |
287129 |
/sbin/ldconfig |
213 |
spuhler |
291495 |
# restart the snmp subagent if needed |
214 |
|
|
/bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || : |
215 |
spuhler |
287129 |
# find all instances |
216 |
|
|
instances="" # instances that require a restart after upgrade |
217 |
|
|
ninst=0 # number of instances found in total |
218 |
spuhler |
291495 |
output=/dev/null |
219 |
|
|
if [ -n "$DEBUGPOSTTRANS" ] ; then |
220 |
|
|
output=$DEBUGPOSTTRANS |
221 |
|
|
fi |
222 |
|
|
echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || : |
223 |
|
|
for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do |
224 |
|
|
if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches |
225 |
|
|
inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'` |
226 |
|
|
echo found instance $inst - getting status > $output 2>&1 || : |
227 |
|
|
if /bin/systemctl -q is-active $inst ; then |
228 |
|
|
echo instance $inst is running > $output 2>&1 || : |
229 |
spuhler |
287129 |
instances="$instances $inst" |
230 |
|
|
else |
231 |
spuhler |
291495 |
echo instance $inst is not running > $output 2>&1 || : |
232 |
spuhler |
287129 |
fi |
233 |
|
|
ninst=`expr $ninst + 1` |
234 |
|
|
done |
235 |
|
|
if [ $ninst -eq 0 ] ; then |
236 |
spuhler |
291495 |
echo no instances to upgrade > $output 2>&1 || : |
237 |
spuhler |
287129 |
exit 0 # have no instances to upgrade - just skip the rest |
238 |
|
|
fi |
239 |
|
|
# shutdown all instances |
240 |
spuhler |
291495 |
echo shutting down all instances . . . > $output 2>&1 || : |
241 |
|
|
/bin/systemctl stop %{groupname} > $output 2>&1 || : |
242 |
|
|
echo remove pid files . . . > $output 2>&1 || : |
243 |
|
|
/bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid |
244 |
spuhler |
287129 |
# do the upgrade |
245 |
spuhler |
291495 |
echo upgrading instances . . . > $output 2>&1 || : |
246 |
|
|
%{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || : |
247 |
spuhler |
287129 |
# restart instances that require it |
248 |
|
|
for inst in $instances ; do |
249 |
spuhler |
291495 |
echo restarting instance $inst > $output 2>&1 || : |
250 |
|
|
/bin/systemctl start $inst > $output 2>&1 || : |
251 |
spuhler |
287129 |
done |
252 |
|
|
exit 0 |
253 |
|
|
|
254 |
spuhler |
291495 |
%preun |
255 |
|
|
if [ $1 -eq 0 ]; then # Final removal |
256 |
|
|
# Package removal, not upgrade |
257 |
|
|
/bin/systemctl --no-reload disable %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || : |
258 |
|
|
/bin/systemctl stop %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || : |
259 |
|
|
# remove instance specific service files/links |
260 |
|
|
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || : |
261 |
|
|
fi |
262 |
|
|
|
263 |
|
|
%postun |
264 |
|
|
/sbin/ldconfig |
265 |
|
|
if [ $1 = 0 ]; then # Final removal |
266 |
|
|
rm -rf /var/run/%{pkgname} |
267 |
|
|
fi |
268 |
|
|
|
269 |
spuhler |
287129 |
%files |
270 |
|
|
%doc LICENSE EXCEPTION LICENSE.GPLv2 |
271 |
|
|
%dir %{_sysconfdir}/%{pkgname} |
272 |
|
|
%dir %{_sysconfdir}/%{pkgname}/schema |
273 |
|
|
%config(noreplace)%{_sysconfdir}/%{pkgname}/schema/*.ldif |
274 |
|
|
%dir %{_sysconfdir}/%{pkgname}/config |
275 |
spuhler |
291495 |
%dir %{_sysconfdir}/systemd/system/%{groupname}.wants |
276 |
spuhler |
287129 |
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/slapd-collations.conf |
277 |
|
|
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/certmap.conf |
278 |
|
|
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf |
279 |
|
|
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/template-initconfig |
280 |
|
|
%config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname} |
281 |
spuhler |
291495 |
%config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}.systemd |
282 |
spuhler |
287129 |
%{_datadir}/%{pkgname} |
283 |
spuhler |
291495 |
%{_unitdir} |
284 |
spuhler |
287129 |
%{_bindir}/* |
285 |
|
|
%{_sbindir}/* |
286 |
|
|
%{_libdir}/%{pkgname}/libns-dshttpd.so* |
287 |
|
|
%{_libdir}/%{pkgname}/perl |
288 |
|
|
%{_libdir}/%{pkgname}/plugins/*.so |
289 |
|
|
%dir %{_localstatedir}/lib/%{pkgname} |
290 |
spuhler |
296942 |
%dir %{_logdir}/%{pkgname} |
291 |
spuhler |
291495 |
%ghost %dir %{_localstatedir}/lock/%{pkgname} |
292 |
spuhler |
287129 |
%{_mandir}/man1/* |
293 |
|
|
%{_mandir}/man8/* |
294 |
|
|
|
295 |
|
|
%files devel |
296 |
spuhler |
296942 |
|
297 |
spuhler |
287129 |
%doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel |
298 |
|
|
%{_includedir}/%{pkgname} |
299 |
|
|
%{_libdir}/%{pkgname}/libslapd.so |
300 |
|
|
%{_libdir}/pkgconfig/* |
301 |
|
|
|
302 |
spuhler |
296942 |
%files -n %{libname} |
303 |
spuhler |
287129 |
%doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel |
304 |
|
|
%{_libdir}/%{pkgname}/libslapd.so.* |