lemonldap-ng.spec 29.9 KB
Newer Older
1 2 3 4
#==============================================================================
# Specification file for LemonLDAP::NG
#
# Install LemonLDAP::NG modules, htdocs and scripts
5 6
# Authority: dries
# Upstream: Xavier Guimard <x,guimard$free,fr>
7 8 9 10 11
#==============================================================================

#==============================================================================
# Variables
#==============================================================================
12
%global lm_prefix %{_prefix}
13 14 15 16 17
%global lm_sharedir %{_datadir}/lemonldap-ng
%global lm_examplesdir %{lm_sharedir}/examples
%global lm_vardir %{_localstatedir}/lib/lemonldap-ng
%global lm_confdir %{_sysconfdir}/lemonldap-ng
%global lm_storagefile %{lm_confdir}/lemonldap-ng.ini
18 19
%global lm_bindir %{_libexecdir}/%{name}/bin
%global lm_sbindir %{_libexecdir}/%{name}/sbin
20

21
# Apache configuration directory
22
%if 0%{?rhel}%{?fedora}
23
%global apache_confdir %{_sysconfdir}/httpd/conf.d
24
%else
25
%global apache_confdir %{_sysconfdir}/apache2/conf.d
26
%endif
27 28

# Apache User and Group
29
%if 0%{?rhel}%{?fedora}
30 31
%global lm_apacheuser apache
%global lm_apachegroup apache
32
%else
33 34
%global lm_apacheuser wwwrun
%global lm_apachegroup www
35
%endif
36

37
# Apache version
38
%if 0%{?fedora} || 0%{?rhel} >= 7
39
%global apache_version 2.4
40
%else
41
%global apache_version 2
42 43
%endif

44
%global lm_dnsdomain example.com
45

46 47
#global pre_release beta1

48 49 50
#==============================================================================
# Main package
#==============================================================================
Xavier Bachelot's avatar
Xavier Bachelot committed
51
Name:           lemonldap-ng
Xavier Guimard's avatar
Xavier Guimard committed
52
Version:        2.0.2
Clément OUDOT's avatar
Clément OUDOT committed
53
Release:        %{?pre_release:0.}1%{?pre_release:.%{pre_release}}%{?dist}
54
Summary:        LemonLDAP-NG WebSSO
Xavier Bachelot's avatar
Xavier Bachelot committed
55
License:        GPLv2+
Clément OUDOT's avatar
Clément OUDOT committed
56
URL:            http://lemonldap-ng.org
57
Source0:        https://release.ow2.org/lemonldap/%{name}-%{version}%{?pre_release:~%{pre_release}}.tar.gz
58
BuildArch:      noarch
59

60
BuildRequires:  perl-generators
61
BuildRequires:  perl-interpreter
Xavier Bachelot's avatar
Xavier Bachelot committed
62 63 64 65 66 67 68 69 70
BuildRequires:  perl(Apache2::Connection)
BuildRequires:  perl(Apache2::Const)
BuildRequires:  perl(Apache2::Filter)
BuildRequires:  perl(Apache2::Log)
BuildRequires:  perl(Apache2::RequestIO)
BuildRequires:  perl(Apache2::RequestRec)
BuildRequires:  perl(Apache2::RequestUtil)
BuildRequires:  perl(Apache2::ServerRec)
BuildRequires:  perl(Apache2::ServerUtil)
Clément OUDOT's avatar
Clément OUDOT committed
71
BuildRequires:  perl(Apache::Session)
Xavier Bachelot's avatar
Xavier Bachelot committed
72 73 74
BuildRequires:  perl(Apache::Session::Generate::MD5)
BuildRequires:  perl(APR::Table)
BuildRequires:  perl(AuthCAS)
75
BuildRequires:  perl(Authen::Captcha)
Xavier Bachelot's avatar
Xavier Bachelot committed
76 77 78 79 80
BuildRequires:  perl(Authen::PAM)
BuildRequires:  perl(Authen::Radius)
BuildRequires:  perl(AutoLoader)
BuildRequires:  perl(base)
BuildRequires:  perl(bytes)
81
BuildRequires:  perl(Cache::Cache)
Xavier Bachelot's avatar
Xavier Bachelot committed
82 83 84
BuildRequires:  perl(Cache::FileCache)
BuildRequires:  perl(Cache::Memcached)
BuildRequires:  perl(CGI)
85 86
BuildRequires:  perl(Class::Inspector)
BuildRequires:  perl(Clone)
Clément OUDOT's avatar
Clément OUDOT committed
87
BuildRequires:  perl(Config::IniFiles)
Xavier Bachelot's avatar
Xavier Bachelot committed
88
BuildRequires:  perl(constant)
89
BuildRequires:  perl(Convert::Base32)
90
BuildRequires:  perl(Convert::PEM)
Xavier Guimard's avatar
Xavier Guimard committed
91
BuildRequires:  perl(Crypt::OpenSSL::Bignum)
Clément OUDOT's avatar
Clément OUDOT committed
92 93
BuildRequires:  perl(Crypt::OpenSSL::RSA)
BuildRequires:  perl(Crypt::OpenSSL::X509)
94
BuildRequires:  perl(Crypt::Rijndael)
95
BuildRequires:  perl(Crypt::URandom)
Xavier Bachelot's avatar
Xavier Bachelot committed
96 97 98 99
BuildRequires:  perl(Data::Dumper)
BuildRequires:  perl(DBI)
BuildRequires:  perl(Digest::HMAC_SHA1)
BuildRequires:  perl(Digest::MD5)
100
BuildRequires:  perl(Digest::SHA)
101
BuildRequires:  perl(Email::Date::Format)
Xavier Bachelot's avatar
Xavier Bachelot committed
102 103 104 105 106
BuildRequires:  perl(Email::Sender)
BuildRequires:  perl(Email::Sender::Simple)
BuildRequires:  perl(Email::Sender::Transport::SMTP)
BuildRequires:  perl(Encode)
BuildRequires:  perl(English)
107
BuildRequires:  perl(Env)
Xavier Bachelot's avatar
Xavier Bachelot committed
108
BuildRequires:  perl(Exporter)
109
BuildRequires:  perl(ExtUtils::MakeMaker)
Xavier Bachelot's avatar
Xavier Bachelot committed
110 111 112 113 114 115 116 117 118
BuildRequires:  perl(FCGI::Client)
BuildRequires:  perl(FCGI::ProcManager)
BuildRequires:  perl(feature)
BuildRequires:  perl(fields)
BuildRequires:  perl(File::Temp)
BuildRequires:  perl(GD::SecurityImage)
BuildRequires:  perl(Getopt::Long)
BuildRequires:  perl(Getopt::Std)
BuildRequires:  perl(GSSAPI)
119
BuildRequires:  perl(HTML::Template)
Xavier Bachelot's avatar
Xavier Bachelot committed
120 121 122 123
BuildRequires:  perl(HTTP::Headers)
BuildRequires:  perl(HTTP::Request)
BuildRequires:  perl(IO::Select)
BuildRequires:  perl(IO::Socket::INET)
124 125
BuildRequires:  perl(IO::String)
BuildRequires:  perl(JSON)
126 127 128 129
%if 0%{?fedora} >= 29
BuildRequires:  perl(Lasso)
BuildRequires:  perl(Glib)
%endif
Xavier Bachelot's avatar
Xavier Bachelot committed
130 131 132 133
BuildRequires:  perl(Log::Log4perl)
BuildRequires:  perl(LWP::Protocol::https)
BuildRequires:  perl(LWP::UserAgent)
BuildRequires:  perl(MIME::Base64)
134
BuildRequires:  perl(MIME::Entity)
Xavier Bachelot's avatar
Xavier Bachelot committed
135
BuildRequires:  perl(mod_perl2)
136 137
BuildRequires:  perl(Mouse)
BuildRequires:  perl(Net::LDAP)
Xavier Bachelot's avatar
Xavier Bachelot committed
138 139
BuildRequires:  perl(Net::LDAP::Extension::SetPassword)
BuildRequires:  perl(Net::LDAP::Util)
140
BuildRequires:  perl(Net::OpenID::Server)
141
BuildRequires:  perl(Plack)
Xavier Bachelot's avatar
Xavier Bachelot committed
142 143 144 145 146 147 148 149
BuildRequires:  perl(Plack::Handler::CGI)
BuildRequires:  perl(Plack::Handler::FCGI)
BuildRequires:  perl(Plack::Middleware)
BuildRequires:  perl(Plack::Request)
BuildRequires:  perl(Plack::Runner)
BuildRequires:  perl(Plack::Util)
BuildRequires:  perl(Plack::Util::Accessor)
BuildRequires:  perl(POSIX)
150 151
BuildRequires:  perl(Regexp::Assemble)
BuildRequires:  perl(Regexp::Common)
Xavier Bachelot's avatar
Xavier Bachelot committed
152 153
BuildRequires:  perl(Safe)
BuildRequires:  perl(Scalar::Util)
154 155 156
%if 0%{?fedora}
BuildRequires:  perl(Sentry::Raven)
%endif
157
BuildRequires:  perl(SOAP::Lite)
Xavier Bachelot's avatar
Xavier Bachelot committed
158 159
BuildRequires:  perl(SOAP::Transport::HTTP)
BuildRequires:  perl(strict)
160
BuildRequires:  perl(String::Random)
Xavier Bachelot's avatar
Xavier Bachelot committed
161
BuildRequires:  perl(Sys::Syslog)
162 163
BuildRequires:  perl(Test::MockObject)
BuildRequires:  perl(Test::Pod) >= 1.00
Xavier Bachelot's avatar
Xavier Bachelot committed
164
BuildRequires:  perl(Time::Local)
165
BuildRequires:  perl(Unicode::String)
Xavier Bachelot's avatar
Xavier Bachelot committed
166 167 168 169 170
BuildRequires:  perl(URI)
BuildRequires:  perl(URI::Escape)
BuildRequires:  perl(URI::URL)
BuildRequires:  perl(utf8)
BuildRequires:  perl(warnings)
171
%if 0%{?fedora}
172
BuildRequires:  perl(Web::ID)
173
%endif
174
BuildRequires:  perl(XML::LibXML)
175 176
BuildRequires:  perl(XML::LibXSLT)
BuildRequires:  perl(XML::Simple)
Xavier Bachelot's avatar
Xavier Bachelot committed
177
BuildRequires:  perl(YAML)
178
BuildRequires:  systemd
179

180 181 182 183 184 185
Requires: lemonldap-ng-conf = %{version}-%{release}
Requires: lemonldap-ng-doc = %{version}-%{release}
Requires: lemonldap-ng-handler = %{version}-%{release}
Requires: lemonldap-ng-manager = %{version}-%{release}
Requires: lemonldap-ng-portal = %{version}-%{release}
Requires: lemonldap-ng-test = %{version}-%{release}
186

187
# Setup requires filtering
188 189
%if 0%{?rhel} >= 7
%{?perl_default_filter}
190
%global __requires_exclude perl\\(Lasso|perl\\(Web::ID|perl\\(Sentry::Raven
191 192 193
%endif

%if 0%{?fedora}
194
%{?perl_default_filter}
195
%if 0%{?fedora} < 29
196
%global __requires_exclude perl\\(Lasso
197
%endif
198
%endif
199

200
%description
201
LemonLdap::NG is a modular Web-SSO based on Apache::Session modules. It
Clément OUDOT's avatar
Clément OUDOT committed
202 203 204 205
simplifies the build of a protected area with a few changes in the
application. It manages both authentication and authorization and provides
headers for accounting. 
So you can have a full AAA protection for your web space as described below.
206

207 208 209
#==============================================================================
# Conf
#==============================================================================
210
%package conf
211
Summary:        LemonLDAP-NG configuration
212 213
Requires:       perl(Apache::Session)
Requires:       perl(IO::String)
214
Requires:       perl(Lemonldap::NG::Common) = %{version}-%{release}
215
Requires:       perl(mod_perl2)
216
%if 0%{?rhel}%{?fedora}
217 218 219 220
Requires(post):  httpd
%else
Requires(post):  apache2
%endif
221

222
%description conf
223 224
This package contains the main storage configuration.

225 226 227
#==============================================================================
# Documentation
#==============================================================================
228
%package doc
229
Summary:        LemonLDAP-NG documentation
230
Requires:       lemonldap-ng-conf = %{version}-%{release}
231

232
%description doc
233
This package contains HTML documentation.
234 235

#==============================================================================
236 237
# Handler
#==============================================================================
238
%package handler
239
Summary:        LemonLDAP-NG handler
240
%if 0%{?rhel}%{?fedora}
241 242
Requires:       crontabs
%endif
243 244
Requires:       lemonldap-ng-conf = %{version}-%{release}
Requires:       perl(Lemonldap::NG::Handler) = %{version}-%{release}
245

246
%description handler
247 248 249 250 251
This package deploys the Apache Handler.

#==============================================================================
# Manager
#==============================================================================
252
%package manager
253
Summary:        LemonLDAP-NG administration interface
254 255
Requires:       lemonldap-ng-conf = %{version}-%{release}
Requires:       perl(Lemonldap::NG::Manager) = %{version}-%{release}
256

257
%description manager
258
This package deploys the administration interface and sessions explorer.
259 260 261 262

#==============================================================================
# Portal
#==============================================================================
263
%package portal
264
Summary:        LemonLDAP-NG authentication portal
265
%if 0%{?rhel}%{?fedora}
266 267
Requires:       crontabs
%endif
268 269
Requires:       lemonldap-ng-conf = %{version}-%{release}
Requires:       perl(Lemonldap::NG::Portal) = %{version}-%{release}
270

271
%description portal
272 273 274 275
This package deploys the authentication portal.

#==============================================================================
# Test
276
#==============================================================================
277
%package test
278
Summary:        LemonLDAP-NG test applications
279
Requires:       lemonldap-ng-conf = %{version}-%{release}
280

281
%description test
282 283
This package deploys small test applications.

284 285 286
#==============================================================================
# FastCGI Server
#==============================================================================
287
%package fastcgi-server
288
Summary:        LemonLDAP-NG FastCGI Server
289
Requires:       lemonldap-ng-conf = %{version}-%{release}
290
%if 0%{?rhel}%{?fedora}
291 292 293 294 295
Requires:       mod_fcgid
%else
Requires:       apache2-mod_fcgid
%endif
Requires:       perl(FCGI::ProcManager)
296

297
%description fastcgi-server
298 299
This package deploys files needed to start a FastCGI server.

Clément OUDOT's avatar
Clément OUDOT committed
300 301 302
#==============================================================================
# UWSGI Application
#==============================================================================
303
%package uwsgi-app
Clément OUDOT's avatar
Clément OUDOT committed
304
Summary:        LemonLDAP-NG UWSGI Application
Xavier Bachelot's avatar
Xavier Bachelot committed
305
Requires:       uwsgi-plugin-psgi
Clément OUDOT's avatar
Clément OUDOT committed
306

307
%description uwsgi-app
Clément OUDOT's avatar
Clément OUDOT committed
308 309 310
LemonLDAP::NG uWSGI server provides a replacement to LemonLDAP::NG FastCGI
server, using uWSGI instead of Plack FCGI.

311 312 313 314 315 316 317 318 319 320
#==============================================================================
# Nginx server
#==============================================================================
%package nginx
Summary:        LemonLDAP-NG Nginx support
Requires:       nginx

%description nginx
Nginx support for LemonLDAP::NG.

321 322 323 324
#==============================================================================
# CPAN modules - Common
#==============================================================================
%package -n perl-Lemonldap-NG-Common
325 326
Summary:        LemonLDAP-NG Common Modules

327
%description -n perl-Lemonldap-NG-Common
328 329
This package installs the configuration libraries used by other LemonLDAP::NG
modules.
330 331

#==============================================================================
332
# CPAN modules - Handler
333 334 335 336 337
#==============================================================================
%package -n perl-Lemonldap-NG-Handler
Summary:        LemonLDAP-NG Handler Modules

%description -n perl-Lemonldap-NG-Handler
338 339
This package installs the Apache module part (handler) used to protect web
areas.
340 341

#==============================================================================
342
# CPAN modules -  Manager
343 344 345 346 347 348 349 350
#==============================================================================
%package -n perl-Lemonldap-NG-Manager
Summary:        LemonLDAP-NG Manager Modules

%description -n perl-Lemonldap-NG-Manager
This package installs the administration interface (manager).

#==============================================================================
351
# CPAN modules - Portal
352 353 354 355 356 357 358
#==============================================================================
%package -n perl-Lemonldap-NG-Portal
Summary:        LemonLDAP-NG Portal Modules

%description -n perl-Lemonldap-NG-Portal
This package installs the authentication portal.

359
#==============================================================================
360
# Source preparation
361
#==============================================================================
362
%prep
363
%setup -q -n %{name}-%{version}%{?pre_release:~%{pre_release}}
364

365

366
#==============================================================================
367
# Building
368
#==============================================================================
369
%build
Xavier Bachelot's avatar
Xavier Bachelot committed
370 371 372
%{__make} %{?_smp_mflags} configure \
    STORAGECONFFILE=%{lm_storagefile} \
    PERLOPTIONS="INSTALLDIRS=vendor"
373
%{__make} %{?_smp_mflags}
374

375
#==============================================================================
376
# Installation
377
#============================================================================
378
%install
379
%{__make} %{?_smp_mflags} install \
Xavier Bachelot's avatar
Xavier Bachelot committed
380 381
    DESTDIR=%{buildroot} \
    PREFIX=%{lm_prefix} \
382 383
    BINDIR=%{lm_bindir} \
    SBINDIR=%{lm_sbindir} \
384
    FASTCGISOCKDIR=%{_rundir}/llng-fastcgi-server \
385
    DOCUMENTROOT=%{lm_sharedir} \
Xavier Bachelot's avatar
Xavier Bachelot committed
386
    EXAMPLESDIR=%{lm_examplesdir} \
387
    HANDLERDIR=%{lm_sharedir}/handler \
Xavier Bachelot's avatar
Xavier Bachelot committed
388 389 390 391 392 393
    MANAGERDIR=%{lm_sharedir}/manager \
    STORAGECONFFILE=%{lm_storagefile} \
    TOOLSDIR=%{lm_sharedir}/ressources \
    CONFDIR=%{lm_confdir} \
    CRONDIR=%{_sysconfdir}/cron.d \
    DATADIR=%{lm_vardir} \
394 395
    INITDIR=%{_sysconfdir}/init.d \
    ETCDEFAULTDIR=%{_sysconfdir}/default \
Xavier Bachelot's avatar
Xavier Bachelot committed
396 397
    DNSDOMAIN=%{lm_dnsdomain} \
    APACHEVERSION=%{apache_version} \
398
    APACHELOGDIR=%{_localstatedir}/log/httpd \
399
    UWSGIYAMLDIR=%{_sysconfdir}/uwsgi/apps-available \
Xavier Bachelot's avatar
Xavier Bachelot committed
400 401
    LLNGAPPDIR=%{lm_sharedir}/llng-server \
    PROD=yes
402

403
# Remove some unwanted files
404 405 406
find %{buildroot} -name .packlist -exec rm -f {} \;
find %{buildroot} -name perllocal.pod -exec rm -f {} \;
find %{buildroot} -name *.bak -exec rm -f {} \;
407

408 409
# Install files for FastCGI Server
mkdir -p %{buildroot}%{_unitdir}
Xavier Bachelot's avatar
Xavier Bachelot committed
410 411
install -m644 fastcgi-server/systemd/llng-fastcgi-server.service \
    %{buildroot}%{_unitdir}
412 413
sed -i \
    -e 's:__FASTCGISOCKDIR__:%{_rundir}/llng-fastcgi-server:' \
414
    -e 's:__SBINDIR__:%{lm_sbindir}:' \
Xavier Bachelot's avatar
Xavier Bachelot committed
415
    %{buildroot}%{_unitdir}/llng-fastcgi-server.service
416
rm -f %{buildroot}%{_sysconfdir}/init.d/llng-fastcgi-server
417 418

mkdir -p %{buildroot}%{_tmpfilesdir}
Xavier Bachelot's avatar
Xavier Bachelot committed
419 420
install -m644 fastcgi-server/systemd/llng-fastcgi-server.tmpfile \
    %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
421 422 423 424
sed -i \
    -e 's:__FASTCGISOCKDIR__:%{_rundir}/llng-fastcgi-server:' \
    -e 's:__USER__:%{lm_apacheuser}:' \
    -e 's:__GROUP__:%{lm_apachegroup}:' \
Xavier Bachelot's avatar
Xavier Bachelot committed
425
    %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
426

Clément OUDOT's avatar
Clément OUDOT committed
427
# UWSGI Application
428
mkdir -p %{buildroot}%{_sysconfdir}/uwsgi/apps-available
Clément OUDOT's avatar
Clément OUDOT committed
429 430
mkdir -p %{buildroot}%{lm_sharedir}/llng-server

Clément OUDOT's avatar
Clément OUDOT committed
431
# Set apache user in some files (see Makefile)
Clément OUDOT's avatar
Clément OUDOT committed
432 433 434
# Note: we do not use the APACHEUSER and APACHEGROUP in make install
# because it launches a 'chown', which is not permitted if RPM is not
# built as root
Clément OUDOT's avatar
Clément OUDOT committed
435
sed -i 's/nobody/%{lm_apacheuser}/' %{buildroot}%{_sysconfdir}/cron.d/*
Xavier Bachelot's avatar
Xavier Bachelot committed
436
sed -i 's/nobody/%{lm_apacheuser}/' \
437
    %{buildroot}%{lm_bindir}/lmConfigEditor
Xavier Bachelot's avatar
Xavier Bachelot committed
438
sed -i 's/nobody/%{lm_apacheuser}/g' \
439
    %{buildroot}%{lm_bindir}/lemonldap-ng-cli
Xavier Bachelot's avatar
Xavier Bachelot committed
440 441
sed -i 's/nobody/%{lm_apacheuser}/g' \
    %{buildroot}%{_sysconfdir}/default/llng-fastcgi-server
442

443
# Set UNIX rights
Clément OUDOT's avatar
Clément OUDOT committed
444
mkdir -p %{buildroot}%{lm_vardir}/sessions/lock
445
mkdir -p %{buildroot}%{lm_vardir}/psessions/lock
446 447 448 449 450
chmod 750 %{buildroot}%{lm_vardir}/conf
chmod 640 %{buildroot}%{lm_vardir}/conf/*
chmod 640 %{buildroot}%{lm_storagefile}
chmod 770 %{buildroot}%{lm_vardir}/sessions
chmod 770 %{buildroot}%{lm_vardir}/sessions/lock
451 452
chmod 770 %{buildroot}%{lm_vardir}/psessions
chmod 770 %{buildroot}%{lm_vardir}/psessions/lock
453
chmod 770 %{buildroot}%{lm_vardir}/notifications
454
chmod 770 %{buildroot}%{lm_vardir}/captcha
455
chmod 775 %{buildroot}%{lm_sbindir}/llng-fastcgi-server
Clément OUDOT's avatar
Clément OUDOT committed
456

457 458 459 460 461 462 463
# Install httpd conf files
# We use "z-lemonldap-ng-*" so that httpd read the files after "perl.conf"
mkdir -p %{buildroot}%{apache_confdir}
for i in handler manager portal test; do {
    mv %{buildroot}%{lm_confdir}/$i-apache%{apache_version}.conf \
        %{buildroot}%{apache_confdir}/z-lemonldap-ng-$i.conf
}; done
464

465 466 467 468
# Install nginx conf files
mkdir -p %{buildroot}%{_sysconfdir}/nginx/conf.d/
mv %{buildroot}%{lm_confdir}/*nginx*.conf \
    %{buildroot}%{_sysconfdir}/nginx/conf.d/
469 470 471 472 473 474 475 476 477
# Move lua and log configuration
mv %{buildroot}%{_sysconfdir}/nginx/conf.d/nginx-lua-headers.conf \
    %{buildroot}%{_sysconfdir}/nginx/conf.d/nginx-lmlog.conf \
    %{buildroot}%{_sysconfdir}/nginx/
# Replace paths in main configuration files
sed -i 's:/etc/lemonldap-ng/nginx-lmlog.conf:/etc/nginx/nginx-lmlog.conf:' \
    %{buildroot}%{_sysconfdir}/nginx/conf.d/handler-nginx.conf
sed -i 's:/etc/lemonldap-ng/nginx-lua-headers.conf:/etc/nginx/nginx-lua-headers.conf:' \
    %{buildroot}%{_sysconfdir}/nginx/conf.d/test-nginx.conf
478

479 480 481
# Remove for_etc_hosts from %%{_sysconfdir}
mv %{buildroot}%{lm_confdir}/for_etc_hosts .

Xavier Bachelot's avatar
Xavier Bachelot committed
482 483 484 485 486 487 488 489 490 491 492
# Fix shebang and perms
sed -i -e 's,#!/usr/bin/env plackup,#!/usr/bin/plackup,' \
    %{buildroot}/usr/share/lemonldap-ng/manager/htdocs/manager.psgi
chmod 755 %{buildroot}/usr/share/lemonldap-ng/manager/htdocs/manager.psgi
sed -i -e 's,#!/usr/bin/env plackup,#!/usr/bin/plackup,' \
    %{buildroot}/usr/share/lemonldap-ng/examples/manager/manager.psgi
chmod 755 %{buildroot}/usr/share/lemonldap-ng/examples/manager/manager.psgi
sed -i -e '1i#!/usr/bin/plackup' \
    %{buildroot}/usr/share/lemonldap-ng/examples/llngapp.psgi
chmod 644 %{buildroot}/usr/share/lemonldap-ng/test/cas.php

493 494 495 496
#==============================================================================
# Run test
#==============================================================================
%check
Xavier Bachelot's avatar
Xavier Bachelot committed
497 498 499 500 501 502
sed -i 's:^dirName.*:dirName = %{buildroot}%{lm_vardir}/conf:' \
    %{buildroot}%{lm_storagefile}
%{__make} %{?_smp_mflags} test \
    LLNG_DEFAULTCONFFILE=%{buildroot}%{lm_storagefile}
sed -i 's:^dirName.*:dirName = %{lm_vardir}/conf:' \
    %{buildroot}%{lm_storagefile}
503

504
#==============================================================================
505
# Post Installation
506
#==============================================================================
507
%post conf
Clément OUDOT's avatar
Clément OUDOT committed
508 509 510
# Upgrade from previous version
# See http://lemonldap-ng.org/documentation/1.0/upgrade
if [ $1 -gt 1 ] ; then
Xavier Bachelot's avatar
Xavier Bachelot committed
511 512 513
    if [ -e %{lm_confdir}/storage.conf \
         -o -e %{lm_confdir}/apply.conf \
         -o -e %{lm_confdir}/apps-list.xml ] ; then
Xavier Bachelot's avatar
Xavier Bachelot committed
514
        # Run migration script
515
        %{lm_bindir}/lmMigrateConfFiles2ini 2>&1 > /dev/null || :
Xavier Bachelot's avatar
Xavier Bachelot committed
516 517 518
        # Fix ownership
        chgrp %{lm_apachegroup} %{lm_storagefile} || :
    fi
519
fi
520 521 522 523 524
# Set editor alternatives if it does not exist
update-alternatives --display editor > /dev/null 2>&1
if [ $? -ne 0 ] ; then
        update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1
fi
525

526
#==============================================================================
527
# Pre uninstallation
528
#==============================================================================
529
%preun conf
Clément OUDOT's avatar
Clément OUDOT committed
530 531
# Upgrade from previous version
if [ $1 -eq 1 ] ; then
532
    # Remove old symlinks in Apache configuration
533 534
    find %{apache_confdir} -name 'z-lemonldap-ng*.conf' \
        -type l -delete 2>&1 > /dev/null || :
535
fi
536

537 538 539 540 541 542 543 544
%post fastcgi-server
%systemd_post llng-fastcgi-server.service

%preun fastcgi-server
%systemd_preun llng-fastcgi-server.service

%postun fastcgi-server
%systemd_postun_with_restart llng-fastcgi-server.service
Clément OUDOT's avatar
Clément OUDOT committed
545

546
%files
547

548
%files conf
549
%doc changelog INSTALL README.md AUTHORS CONTRIBUTING.md
550
%doc for_etc_hosts
Clément OUDOT's avatar
Clément OUDOT committed
551
%license COPYING LICENSE
Clément OUDOT's avatar
Clément OUDOT committed
552
%dir %{lm_confdir}
553
%config(noreplace) %attr(-,root,%{lm_apachegroup}) %{lm_storagefile}
554 555 556
%config(noreplace) %{apache_confdir}/z-lemonldap-ng-handler.conf
%config(noreplace) %{apache_confdir}/z-lemonldap-ng-manager.conf
%config(noreplace) %{apache_confdir}/z-lemonldap-ng-portal.conf
557
%{_mandir}/man1/convertConfig*
558 559 560 561 562 563 564
%dir %{_libexecdir}/%{name}
%dir %{lm_sbindir}
%dir %{lm_bindir}
%{lm_bindir}/convertConfig
%{lm_bindir}/importMetadata
%{lm_bindir}/lmMigrateConfFiles2ini
%{lm_bindir}/rotateOidcKeys
565
%dir %{lm_examplesdir}
566
%dir %{lm_sharedir}
567
%{lm_sharedir}/ressources/
568
%dir %{lm_vardir}
569
%defattr(640,%{lm_apacheuser},%{lm_apachegroup},750)
Clément OUDOT's avatar
Clément OUDOT committed
570 571 572
%dir %{lm_vardir}/conf
%dir %{lm_vardir}/sessions
%dir %{lm_vardir}/sessions/lock
573 574
%dir %{lm_vardir}/psessions
%dir %{lm_vardir}/psessions/lock
575
%dir %{lm_vardir}/notifications
Clément OUDOT's avatar
Clément OUDOT committed
576
%config(noreplace) %{lm_vardir}/conf/lmConf-1.json
577

578
%files doc
579
%doc %{lm_sharedir}/doc
580
%doc changelog INSTALL README.md AUTHORS CONTRIBUTING.md
Clément OUDOT's avatar
Clément OUDOT committed
581
%license COPYING LICENSE
582

583
%files handler
584
%{lm_bindir}/purgeLocalCache
585
%config(noreplace) %{_sysconfdir}/cron.d/lemonldap-ng-handler
586
%{lm_sharedir}/handler
587
%{lm_examplesdir}/handler
588
%{lm_sharedir}/llng-server/llng-server.psgi
589

590
%files manager
Clément OUDOT's avatar
Clément OUDOT committed
591 592
%{lm_sharedir}/manager
%{lm_examplesdir}/manager
593 594
%{lm_bindir}/lmConfigEditor
%{lm_bindir}/lemonldap-ng-cli
595
%{_mandir}/man1/lemonldap-ng-cli*
596

597
%files portal
598 599
%{lm_sharedir}/portal
%{lm_bindir}/purgeCentralCache
600
%config(noreplace) %{_sysconfdir}/cron.d/lemonldap-ng-portal
601
%{lm_examplesdir}/portal
602 603
%defattr(750,%{lm_apacheuser},%{lm_apachegroup},-)
%dir %{lm_vardir}/captcha
604

605
%files test
606
%{lm_sharedir}/test
607
%config(noreplace) %{apache_confdir}/z-lemonldap-ng-test.conf
608

609
%files fastcgi-server
610
%{lm_sbindir}/llng-fastcgi-server
611
%config(noreplace) %{_sysconfdir}/default/llng-fastcgi-server
612
%{_unitdir}/llng-fastcgi-server.service
613
%{_tmpfilesdir}/llng-fastcgi-server.conf
614
%defattr(755,%{lm_apacheuser},%{lm_apachegroup},-)
615
%dir %{_rundir}/llng-fastcgi-server
Clément OUDOT's avatar
Clément OUDOT committed
616 617
%{lm_sharedir}/examples/llngapp.psgi

618
%files uwsgi-app
619
%config(noreplace) %{_sysconfdir}/uwsgi/apps-available/llng-server.yaml
620

621 622 623
%files nginx
%config(noreplace) %{_sysconfdir}/nginx/conf.d/handler-nginx.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/manager-nginx.conf
624 625
%config(noreplace) %{_sysconfdir}/nginx/nginx-lmlog.conf
%config(noreplace) %{_sysconfdir}/nginx/nginx-lua-headers.conf
626 627 628
%config(noreplace) %{_sysconfdir}/nginx/conf.d/portal-nginx.conf
%config(noreplace) %{_sysconfdir}/nginx/conf.d/test-nginx.conf

629
%files -n perl-Lemonldap-NG-Common
630
%{_mandir}/man3/Lemonldap::NG::Common*.3pm.*
631 632
%dir %{perl_vendorlib}/Lemonldap
%dir %{perl_vendorlib}/Lemonldap/NG
633 634
%{perl_vendorlib}/Lemonldap/NG/Common.pm
%{perl_vendorlib}/Lemonldap/NG/Common/
Clément OUDOT's avatar
Clément OUDOT committed
635
%{perl_vendorlib}/auto/Lemonldap/NG/Common/
636 637

%files -n perl-Lemonldap-NG-Handler
638 639
%{_mandir}/man3/Lemonldap::NG::Handler*.3pm.*
%{_mandir}/man3/Plack::Middleware::Auth::LemonldapNG.3pm.*
640 641
%{perl_vendorlib}/Lemonldap/NG/Handler.pm
%{perl_vendorlib}/Lemonldap/NG/Handler/
642
%{perl_vendorlib}/auto/Lemonldap/NG/Handler/
643
%{perl_vendorlib}/Plack/Middleware/Auth/LemonldapNG.pm
644 645

%files -n perl-Lemonldap-NG-Manager
646
%{_mandir}/man3/Lemonldap::NG::Manager*.3pm.*
647 648 649 650
%{perl_vendorlib}/Lemonldap/NG/Manager.pm
%{perl_vendorlib}/Lemonldap/NG/Manager/

%files -n perl-Lemonldap-NG-Portal
651
%{_mandir}/man3/Lemonldap::NG::Portal*.3pm.*
652 653
%{perl_vendorlib}/Lemonldap/NG/Portal.pm
%{perl_vendorlib}/Lemonldap/NG/Portal/
654

655
#==============================================================================
656
# Changelog
657
#==============================================================================
658
%changelog
Clément OUDOT's avatar
Clément OUDOT committed
659
* Tue Feb 12 2019 Clement Oudot <clem.oudot@gmail.com> - 2.0.2-1
660 661
- Update to 2.0.2

Clément OUDOT's avatar
Clément OUDOT committed
662 663 664
* Fri Dec 21 2018 Clement Oudot <clem.oudot@gmail.com> - 2.0.1-1
- Update to 2.0.1

Clément OUDOT's avatar
Clément OUDOT committed
665 666 667
* Sat Dec 01 2018 Clement Oudot <clem.oudot@gmail.com> - 2.0.0-3
- Fix warnings in Manager

Xavier Bachelot's avatar
Xavier Bachelot committed
668 669 670
* Fri Nov 30 2018 Xavier Bachelot <xavier@bachelot.org> - 2.0.0-2
- Huge spec file cleanup.

Clément OUDOT's avatar
Clément OUDOT committed
671 672
* Fri Nov 30 2018 Clement Oudot <clem.oudot@gmail.com> - 2.0.0-1
- Update to 2.0.0
673

674 675 676
* Fri Oct 05 2018 Clement Oudot <clem.oudot@gmail.com> - 1.9.18-1
- Update to 1.9.18

Clément OUDOT's avatar
Clément OUDOT committed
677
* Fri Jul 20 2018 Clement Oudot <clem.oudot@gmail.com> - 2.0.0~beta1-1
Clément OUDOT's avatar
Clément OUDOT committed
678
- First beta version for 2.0.0
679

680
* Sun Jun 17 2018 Clement Oudot <clem.oudot@gmail.com> - 1.9.17-1
681 682 683 684 685
- Update to 1.9.17

* Fri Mar 16 2018 Clement Oudot <clem.oudot@gmail.com> - 1.9.16-1
- Update to 1.9.16

Clément OUDOT's avatar
Clément OUDOT committed
686 687
* Fri Jan 26 2018 Clement Oudot <clem.oudot@gmail.com> - 2.0.0~alpha3-1
- Third alpha version for 2.0.0
688

Clément OUDOT's avatar
Clément OUDOT committed
689 690
* Tue Jan 23 2018 Clement Oudot <clem.oudot@gmail.com> - 1.9.15-1
- Update to 1.9.15
691

Clément OUDOT's avatar
Clément OUDOT committed
692 693
* Fri Nov 24 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.14-1
- Update to 1.9.14
694

695 696
* Fri Sep 29 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.13-1
- Update to 1.9.13
697

Clément OUDOT's avatar
Clément OUDOT committed
698 699
* Thu Sep 14 2017 Clement Oudot <clem.oudot@gmail.com> - 2.0.0~alpha2-1
- Second alpha version for 2.0.0
700

701 702
* Tue Sep 12 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.12-1
- Update to 1.9.12
703

Clément OUDOT's avatar
Clément OUDOT committed
704 705
* Fri Sep 01 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.11-1
- Update to 1.9.11
706

707 708
* Mon Jul 10 2017 Clement Oudot <clem.oudot@gmail.com> - 2.0.0~alpha1-1
- First alpha version for 2.0.0
709

Clément OUDOT's avatar
Clément OUDOT committed
710 711
* Fri May 19 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.10-1
- Update to 1.9.10
712

Clément OUDOT's avatar
Clément OUDOT committed
713 714
* Thu Mar 16 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.9-1
- Update to 1.9.9
715

716 717
* Thu Mar 02 2017 Clement Oudot <clem.oudot@gmail.com> - 1.9.8-1
- Update to 1.9.8
718

719 720
* Mon Dec 12 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.7-1
- Update to 1.9.7
721

Clément OUDOT's avatar
Clément OUDOT committed
722 723
* Fri Oct 14 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.6-1
- Update to 1.9.6
724

725
* Mon Oct 10 2016 Clement Oudot <clem.oudot@gmail.com> - 1.4.11-1
726
- Update to 1.4.11
727

728 729
* Wed Jul 13 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.5-1
- Update to 1.9.5
730

731 732
* Wed Jul 13 2016 Clement Oudot <clem.oudot@gmail.com> - 1.4.10-1
- Update to 1.4.10
733

Clément OUDOT's avatar
Clément OUDOT committed
734 735
* Tue Jun 14 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.4-1
- Update to 1.9.4
736

Clément OUDOT's avatar
Clément OUDOT committed
737 738
* Tue Jun 07 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.3-1
- Update to 1.9.3
739

740 741
* Fri Jun 03 2016 Clement Oudot <clem.oudot@gmail.com> - 1.4.9-1
- Update to 1.4.9
742

743 744
* Sun May 01 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.2-1
- Update to 1.9.2
745

746 747
* Wed Apr 27 2016 Clement Oudot <clem.oudot@gmail.com> - 1.4.8-1
- Update to 1.4.8
748

749 750
* Thu Mar 31 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.1-1
- Update to 1.9.1
751

752 753
* Thu Mar 17 2016 Clement Oudot <clem.oudot@gmail.com> - 1.4.7-1
- Update to 1.4.7
754

755
* Wed Mar 02 2016 Clement Oudot <clem.oudot@gmail.com> - 1.9.0-1
Clément OUDOT's avatar
Clément OUDOT committed
756
- Update to 1.9.0
757

758 759
* Mon Sep 28 2015 Clement Oudot <clem.oudot@gmail.com> - 1.4.6-1
- Update to 1.4.6
760

761 762
* Mon May 11 2015 Clement Oudot <clem.oudot@gmail.com> - 1.4.5-1
- Update to 1.4.5
763

764
* Wed Apr 15 2015 Clement Oudot <clem.oudot@gmail.com> - 1.4.4-1
765
- Update to 1.4.4
766

767 768 769
* Thu Dec 18 2014 Clement Oudot <clem.oudot@gmail.com> - 1.4.3-1
- Update to 1.4.3
- Support for CentOS 7
770

771 772
* Fri Oct 31 2014 Clement Oudot <clem.oudot@gmail.com> - 1.4.2-1
- Update to 1.4.2
773

774 775
* Fri Jul 25 2014 Clement Oudot <clem.oudot@gmail.com> - 1.4.1-1
- Update to 1.4.1
776

Clément OUDOT's avatar
Clément OUDOT committed
777 778
* Fri Apr 18 2014 Clement Oudot <clem.oudot@gmail.com> - 1.4.0-1
- Update to 1.4.0
779

Clément OUDOT's avatar
Clément OUDOT committed
780 781
* Fri Mar 07 2014 Clement Oudot <clem.oudot@gmail.com> - 1.3.3-1
- Update to 1.3.3
782

Clément OUDOT's avatar
Clément OUDOT committed
783 784
* Thu Jan 23 2014 Clement Oudot <clem.oudot@gmail.com> - 1.3.2-1
- Update to 1.3.2
785

Clément OUDOT's avatar
Clément OUDOT committed
786 787
* Mon Nov 11 2013 Clement Oudot <clem.oudot@gmail.com> - 1.3.1-1
- Update to 1.3.1
788

Clément OUDOT's avatar
Clément OUDOT committed
789 790
* Sat Nov 2 2013 Clement Oudot <clem.oudot@gmail.com> - 1.3.0-1
- Update to 1.3.0
791

Clément OUDOT's avatar
Clément OUDOT committed
792 793
* Mon Aug 26 2013 Clement Oudot <clem.oudot@gmail.com> - 1.2.5-1
- Update to 1.2.5
794

Clément OUDOT's avatar
Clément OUDOT committed
795 796
* Tue Apr 23 2013 Clement Oudot <clem.oudot@gmail.com> - 1.2.4-1
- Update to 1.2.4
797

Clément OUDOT's avatar
Clément OUDOT committed
798 799
* Fri Feb 08 2013 Clement Oudot <clem.oudot@gmail.com> - 1.2.3-1
- Update to 1.2.3
800

801 802
* Mon Sep 17 2012 Clement Oudot <clem.oudot@gmail.com> - 1.2.2-1
- Update to 1.2.2
803

804
* Thu Jul 05 2012 Clement Oudot <clem.oudot@gmail.com> - 1.2.1-1
805
- Update to 1.2.1
806

807
* Sun Jun 17 2012 Clement Oudot <clem.oudot@gmail.com> - 1.2.0-1
808
- Update to 1.2.0
809

810 811
* Fri Oct 07 2011 Clement Oudot <clem.oudot@gmail.com> - 1.1.2-1
- Update to 1.1.2
812

813 814
* Fri Jul 29 2011 Clement Oudot <clem.oudot@gmail.com> - 1.1.1-1
- Update to 1.1.1
815

Clément OUDOT's avatar
Clément OUDOT committed
816 817
* Fri Jul 08 2011 Clement Oudot <clem.oudot@gmail.com> - 1.1.0-1
- Update to 1.1.0
818

819
* Thu Jun 30 2011 Clement Oudot <clem.oudot@gmail.com> - 1.0.6-1
Clément OUDOT's avatar
Clément OUDOT committed
820
- Update to 1.0.6
821

822 823
* Fri Apr 15 2011 Clement Oudot <clem.oudot@gmail.com> - 1.0.5-1
- Update to 1.0.5
824

Clément OUDOT's avatar
Clément OUDOT committed
825 826
* Tue Mar 22 2011 Clement Oudot <clem.oudot@gmail.com> - 1.0.4-1
- Update to 1.0.4
827

828 829
* Mon Mar 07 2011 Clement Oudot <clem.oudot@gmail.com> - 1.0.3-1
- Update to 1.0.3
830

831 832
* Mon Feb 28 2011 Clement Oudot <clem.oudot@gmail.com> - 1.0.2-1
- Update to 1.0.2
833

834 835
* Thu Dec 16 2010 Clement Oudot <clem.oudot@gmail.com> - 1.0.1-1
- Update to 1.0.1
836

Clément OUDOT's avatar
Clément OUDOT committed
837 838
* Fri Nov 26 2010 Clement Oudot <clem.oudot@gmail.com> - 1.0-1
- Update to 1.0
839

Clément OUDOT's avatar
Clément OUDOT committed
840 841 842
* Wed Jul 21 2010 Nicolas Chauvet <kwizart@gmail.com> - 0.9.4.1-3
- Fix compatibility with perl-LDAP 0.40
- Add BR perl(Auth::CAS)
843

Clément OUDOT's avatar
Clément OUDOT committed
844 845
* Mon Jul 12 2010 Nicolas Chauvet <nchauvet@linagora.com> - 0.9.4.1-2
- Protect lemonldap directories against word readability
846

Clément OUDOT's avatar
Clément OUDOT committed
847 848
* Mon Oct 12 2009 Nicolas Chauvet <nchauvet@linagora.com> - 0.9.4.1-1
- Update to 0.9.4.1
849

Clément OUDOT's avatar
Clément OUDOT committed
850 851 852 853
* Thu Sep 24 2009 Nicolas Chauvet <nchauvet@linagora.com> - 0.9.4-2
- Add Missing BuildRequires
- Remove filter for dependencies available in EPEL.
- use %%defattr to define ownership.
854

855
* Mon Jul 6 2009 Clement Oudot <coudot@linagora.com> - 0.9.4-1
856 857 858
- Upgrade to release 0.9.4
- Remove cronjob patch (included in 0.9.4)
- Split scriplets into subpackages
859
- Use conditions to build for other RPM distributions like OpenSuSE (thanks to clauded1)
860

861 862 863 864
* Mon Jan 12 2009 Clement Oudot <coudot@linagora.com> - 0.9.3.2-2
- Include cronjob patch
- Delete unwanted files (perllocal.pod, .packlist)
- Follow rpmfusion guidelines
865

866
* Fri Jan 9 2009 Clement Oudot <coudot@linagora.com> - 0.9.3.2-1
867
- Updated to release 0.9.3.2.
868
- Use internal version number for perl modules (compatibility with RPMforge packages)
869 870
- Merge with existing .spec file from RPMforge.
- Use the same directories as the Debian package.
871
- Create a symlink in Apache confguration.
Xavier Guimard's avatar
Xavier Guimard committed
872
- Create specific portal/manager/handler/conf packages independent from CPAN packages
873

874 875 876
* Thu Nov 20 2008 Jean-Christophe Toussaint <jean-christophe.toussaint@ac-nancy-metz.fr> - 0.9.2-1DSI
- Updated to release 0.9.2.
- Using official tar.gz from forge.
877

878
* Tue Oct 7 2008 David Hannequin <david.hannequin@linagora.com> 
879
- New spec file
880

881 882
* Sun Mar 02 2008 Dag Wieers <dag@wieers.com> - 0.85-1
- Updated to release 0.85.
883

884 885
* Tue Nov 13 2007 Dag Wieers <dag@wieers.com> - 0.84-1
- Updated to release 0.84.
886

887 888
* Wed May 02 2007 Dries Verachtert <dries@ulyssis.org> - 0.81-1
- Updated to release 0.81.
889

890 891
* Sun Apr 29 2007 Dries Verachtert <dries@ulyssis.org> - 0.75-1
- Initial package.