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