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 |
|
|
%global use_db4 0 |
12 |
|
|
# If perl-Socket-2.000 or newer is available, set 0 to use_Socket6. |
13 |
|
|
%global use_Socket6 0 |
14 |
spuhler |
287129 |
|
15 |
colin |
321807 |
# (cg) NB the --with-tmpfiles_d argument below is for user generated config files |
16 |
|
|
# created via DSCreate.pm script - i.e. it should be the /etc/ path, NOT %_tmpfilesdir |
17 |
|
|
|
18 |
spuhler |
398874 |
# Mageia 3 and later uses tmpfiles.d |
19 |
spuhler |
287129 |
# otherwise, comment this out |
20 |
colin |
321807 |
%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} |
21 |
spuhler |
287129 |
|
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 |
398874 |
Version: 1.3.0.0 |
28 |
|
|
Release: %mkrel 2 |
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 |
398874 |
# this is neede be some setup scripts such as setup-kolab |
69 |
|
|
Requires: libselinux-utils |
70 |
spuhler |
287129 |
|
71 |
|
|
# the following are needed for some of our scripts |
72 |
|
|
%if %{use_openldap} |
73 |
spuhler |
291495 |
Requires: openldap-clients |
74 |
spuhler |
287129 |
%else |
75 |
|
|
Requires: mozldap-tools |
76 |
|
|
%endif |
77 |
|
|
# use_openldap assumes perl-Mozilla-LDAP is built with openldap support |
78 |
|
|
Requires: perl-Mozilla-LDAP |
79 |
|
|
|
80 |
|
|
# this is needed to setup SSL if you are not using the |
81 |
|
|
# administration server package |
82 |
spuhler |
291495 |
Requires: nss |
83 |
spuhler |
287129 |
|
84 |
|
|
# these are not found by the auto-dependency method |
85 |
|
|
# they are required to support the mandatory LDAP SASL mechs |
86 |
spuhler |
300646 |
Requires: sasl-plug-gssapi |
87 |
|
|
Requires: sasl-plug-digestmd5 |
88 |
spuhler |
287129 |
|
89 |
|
|
# this is needed for verify-db.pl |
90 |
spuhler |
291495 |
%if %{use_db4} |
91 |
spuhler |
287129 |
Requires: db4-utils |
92 |
spuhler |
291495 |
%else |
93 |
spuhler |
296942 |
Requires: db5-utils |
94 |
spuhler |
291495 |
%endif |
95 |
spuhler |
287129 |
|
96 |
|
|
# This picks up libperl.so as a Requires, so we add this versioned one |
97 |
spuhler |
305248 |
#Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) |
98 |
spuhler |
287129 |
|
99 |
|
|
# for the init script |
100 |
spuhler |
291495 |
Requires(post): systemd-units |
101 |
|
|
Requires(preun): systemd-units |
102 |
|
|
Requires(postun): systemd-units |
103 |
spuhler |
287129 |
|
104 |
spuhler |
291495 |
# for setup-ds.pl to support ipv6 |
105 |
|
|
%if %{use_Socket6} |
106 |
|
|
Requires: perl-Socket6 |
107 |
|
|
%else |
108 |
|
|
Requires: perl-Socket |
109 |
|
|
%endif |
110 |
|
|
Requires: perl-NetAddr-IP |
111 |
|
|
|
112 |
spuhler |
287129 |
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2 |
113 |
|
|
# 389-ds-git.sh should be used to generate the source tarball from git |
114 |
|
|
Source1: %{name}-git.sh |
115 |
|
|
Source2: %{name}-devel.README |
116 |
|
|
|
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 |
398874 |
%package libs |
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 |
%if %{use_db4} |
133 |
spuhler |
287129 |
BuildRequires: db4-devel |
134 |
spuhler |
291495 |
%else |
135 |
|
|
BuildRequires: db-devel |
136 |
|
|
%endif |
137 |
spuhler |
300646 |
BuildRequires: libsasl-devel |
138 |
spuhler |
287129 |
BuildRequires: libicu-devel |
139 |
|
|
BuildRequires: pcre-devel |
140 |
|
|
|
141 |
spuhler |
305913 |
%description libs |
142 |
spuhler |
287129 |
Core libraries for the 389 Directory Server base package. These libraries |
143 |
|
|
are used by the main package and the -devel package. This allows the -devel |
144 |
|
|
package to be installed with just the -libs package and without the main package. |
145 |
|
|
|
146 |
|
|
%package devel |
147 |
|
|
Summary: Development libraries for 389 Directory Server |
148 |
spuhler |
296942 |
Group: System/Libraries |
149 |
spuhler |
287129 |
Requires: %{name}-libs = %{version}-%{release} |
150 |
|
|
Requires: pkgconfig |
151 |
|
|
Requires: nspr-devel |
152 |
|
|
Requires: nss-devel |
153 |
|
|
Requires: svrcore-devel |
154 |
|
|
%if %{use_openldap} |
155 |
|
|
Requires: openldap-devel |
156 |
|
|
%else |
157 |
|
|
Requires: mozldap-devel |
158 |
|
|
%endif |
159 |
|
|
|
160 |
|
|
%description devel |
161 |
|
|
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 |
|
|
|
167 |
|
|
%build |
168 |
spuhler |
398874 |
|
169 |
spuhler |
287129 |
%if %{use_openldap} |
170 |
|
|
OPENLDAP_FLAG="--with-openldap" |
171 |
|
|
%endif |
172 |
colin |
321807 |
%{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"} |
173 |
spuhler |
305248 |
%configure2_5x --enable-autobind \ |
174 |
spuhler |
296942 |
--with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \ |
175 |
spuhler |
291495 |
--with-systemdsystemunitdir=%{_unitdir} \ |
176 |
|
|
--with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \ |
177 |
spuhler |
331346 |
--with-systemdgroupname=%{groupname} |
178 |
spuhler |
287129 |
|
179 |
|
|
# Generate symbolic info for debuggers |
180 |
|
|
export XCFLAGS=$RPM_OPT_FLAGS |
181 |
|
|
|
182 |
spuhler |
398874 |
%ifarch x86_64 |
183 |
|
|
export USE_64=1 |
184 |
|
|
%endif |
185 |
spuhler |
305248 |
|
186 |
spuhler |
398874 |
|
187 |
spuhler |
296942 |
%make |
188 |
spuhler |
287129 |
|
189 |
|
|
|
190 |
|
|
%install |
191 |
spuhler |
398874 |
make DESTDIR="%{buildroot}" install |
192 |
spuhler |
287129 |
|
193 |
spuhler |
398874 |
mkdir -p %{buildroot}/var/log/%{pkgname} |
194 |
|
|
mkdir -p %{buildroot}/var/lib/%{pkgname} |
195 |
|
|
mkdir -p %{buildroot}/var/lock/%{pkgname} |
196 |
spuhler |
287129 |
|
197 |
spuhler |
398874 |
# for systemd |
198 |
|
|
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/%{groupname}.wants |
199 |
|
|
|
200 |
spuhler |
287129 |
#remove libtool and static libs |
201 |
spuhler |
398874 |
rm -f %{buildroot}%{_libdir}/%{pkgname}/*.a |
202 |
|
|
rm -f %{buildroot}%{_libdir}/%{pkgname}/*.la |
203 |
|
|
rm -f %{buildroot}%{_libdir}/%{pkgname}/plugins/*.a |
204 |
|
|
rm -f %{buildroot}%{_libdir}/%{pkgname}/plugins/*.la |
205 |
spuhler |
287129 |
|
206 |
|
|
# make sure perl scripts have a proper shebang |
207 |
spuhler |
398874 |
sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' %{buildroot}%{_datadir}/%{pkgname}/script-templates/template-*.pl |
208 |
spuhler |
287129 |
|
209 |
|
|
%post |
210 |
spuhler |
398874 |
output=/dev/null |
211 |
|
|
%systemd_post %{pkgname}-snmp.service |
212 |
spuhler |
291495 |
# reload to pick up any changes to systemd files |
213 |
|
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || : |
214 |
|
|
# reload to pick up any shared lib changes |
215 |
spuhler |
287129 |
/sbin/ldconfig |
216 |
spuhler |
291495 |
# restart the snmp subagent if needed |
217 |
|
|
/bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || : |
218 |
spuhler |
287129 |
# find all instances |
219 |
|
|
instances="" # instances that require a restart after upgrade |
220 |
|
|
ninst=0 # number of instances found in total |
221 |
spuhler |
291495 |
if [ -n "$DEBUGPOSTTRANS" ] ; then |
222 |
|
|
output=$DEBUGPOSTTRANS |
223 |
|
|
fi |
224 |
|
|
echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || : |
225 |
|
|
for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do |
226 |
|
|
if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches |
227 |
|
|
inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'` |
228 |
|
|
echo found instance $inst - getting status > $output 2>&1 || : |
229 |
|
|
if /bin/systemctl -q is-active $inst ; then |
230 |
|
|
echo instance $inst is running > $output 2>&1 || : |
231 |
spuhler |
287129 |
instances="$instances $inst" |
232 |
|
|
else |
233 |
spuhler |
291495 |
echo instance $inst is not running > $output 2>&1 || : |
234 |
spuhler |
287129 |
fi |
235 |
|
|
ninst=`expr $ninst + 1` |
236 |
|
|
done |
237 |
|
|
if [ $ninst -eq 0 ] ; then |
238 |
spuhler |
291495 |
echo no instances to upgrade > $output 2>&1 || : |
239 |
spuhler |
287129 |
exit 0 # have no instances to upgrade - just skip the rest |
240 |
|
|
fi |
241 |
|
|
# shutdown all instances |
242 |
spuhler |
291495 |
echo shutting down all instances . . . > $output 2>&1 || : |
243 |
|
|
/bin/systemctl stop %{groupname} > $output 2>&1 || : |
244 |
|
|
echo remove pid files . . . > $output 2>&1 || : |
245 |
|
|
/bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid |
246 |
spuhler |
287129 |
# do the upgrade |
247 |
spuhler |
291495 |
echo upgrading instances . . . > $output 2>&1 || : |
248 |
|
|
%{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || : |
249 |
spuhler |
287129 |
# restart instances that require it |
250 |
|
|
for inst in $instances ; do |
251 |
spuhler |
291495 |
echo restarting instance $inst > $output 2>&1 || : |
252 |
|
|
/bin/systemctl start $inst > $output 2>&1 || : |
253 |
spuhler |
287129 |
done |
254 |
|
|
exit 0 |
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 |
|
|
/sbin/ldconfig |
266 |
|
|
if [ $1 = 0 ]; then # Final removal |
267 |
|
|
rm -rf /var/run/%{pkgname} |
268 |
|
|
fi |
269 |
|
|
|
270 |
spuhler |
287129 |
%files |
271 |
|
|
%doc LICENSE EXCEPTION LICENSE.GPLv2 |
272 |
|
|
%dir %{_sysconfdir}/%{pkgname} |
273 |
|
|
%dir %{_sysconfdir}/%{pkgname}/schema |
274 |
|
|
%config(noreplace)%{_sysconfdir}/%{pkgname}/schema/*.ldif |
275 |
|
|
%dir %{_sysconfdir}/%{pkgname}/config |
276 |
|
|
%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 |
287129 |
%{_mandir}/man1/* |
292 |
|
|
%{_mandir}/man8/* |
293 |
|
|
|
294 |
|
|
%files devel |
295 |
|
|
%doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel |
296 |
|
|
%{_includedir}/%{pkgname} |
297 |
|
|
%{_libdir}/%{pkgname}/libslapd.so |
298 |
|
|
%{_libdir}/pkgconfig/* |
299 |
|
|
|
300 |
spuhler |
305913 |
%files libs |
301 |
spuhler |
287129 |
%doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel |
302 |
|
|
%{_libdir}/%{pkgname}/libslapd.so.* |