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