Commit 23160100 authored by Clément OUDOT's avatar Clément OUDOT

Merge branch 'specfile-cleanup' into 'master'

[RFC] RPM packaging cleanups and fixes

See merge request !46
parents 8b0360e0 6edb1f46
......@@ -9,102 +9,187 @@
#==============================================================================
# Variables
#==============================================================================
%define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
%define perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
%define real_name lemonldap-ng
%define real_version 2.0.0
%define cpan_version 2.0.0
%define cpan_common_version %{cpan_version}
%define cpan_handler_version %{cpan_version}
%define cpan_manager_version %{cpan_version}
%define cpan_portal_version %{cpan_version}
%define lm_prefix /usr
%define lm_sharedir %{_datadir}/lemonldap-ng
%define lm_examplesdir %{lm_sharedir}/examples
%define lm_vardir %{_localstatedir}/lib/lemonldap-ng
%define lm_confdir %{_sysconfdir}/lemonldap-ng
%define lm_storagefile %{lm_confdir}/lemonldap-ng.ini
%global lm_prefix %{_prefix}
%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
%global lm_bindir %{_libexecdir}/%{name}/bin
%global lm_sbindir %{_libexecdir}/%{name}/sbin
# Apache configuration directory
%if 0%{?rhl}%{?rhel}%{?fedora}
%define apache_confdir %{_sysconfdir}/httpd/conf.d
%if 0%{?rhel}%{?fedora}
%global apache_confdir %{_sysconfdir}/httpd/conf.d
%else
%define apache_confdir /etc/apache2/conf.d
%global apache_confdir %{_sysconfdir}/apache2/conf.d
%endif
# Apache User and Group
%if 0%{?rhl}%{?rhel}%{?fedora}
%define lm_apacheuser apache
%define lm_apachegroup apache
%if 0%{?rhel}%{?fedora}
%global lm_apacheuser apache
%global lm_apachegroup apache
%else
%define lm_apacheuser wwwrun
%define lm_apachegroup www
%global lm_apacheuser wwwrun
%global lm_apachegroup www
%endif
# Apache version
%if 0%{?rhel} >= 7
%define apache_version 2.4
%if 0%{?fedora} || 0%{?rhel} >= 7
%global apache_version 2.4
%else
%define apache_version 2
%global apache_version 2
%endif
%define lm_dnsdomain example.com
%global lm_dnsdomain example.com
#global pre_release beta1
#==============================================================================
# Main package
#==============================================================================
Name: %{real_name}
Version: %{real_version}
Release: 1%{?dist}
Name: lemonldap-ng
Version: 2.0.0
Release: %{?pre_release:0.}2%{?pre_release:.%{pre_release}}%{?dist}
Summary: LemonLDAP-NG WebSSO
License: GPL v2
License: GPLv2+
URL: http://lemonldap-ng.org
Source0: http://lemonldap-ng.org/download/%{name}-%{version}.tar.gz
Source0: https://release.ow2.org/lemonldap/%{name}-%{version}%{?pre_release:~%{pre_release}}.tar.gz
BuildArch: noarch
BuildRequires: perl-generators
BuildRequires: perl-interpreter
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)
BuildRequires: perl(Apache::Session)
BuildRequires: perl(Apache::Session::Generate::MD5)
BuildRequires: perl(APR::Table)
BuildRequires: perl(AuthCAS)
BuildRequires: perl(Authen::Captcha)
BuildRequires: perl(Authen::PAM)
BuildRequires: perl(Authen::Radius)
BuildRequires: perl(AutoLoader)
BuildRequires: perl(base)
BuildRequires: perl(bytes)
BuildRequires: perl(Cache::Cache)
BuildRequires: perl(Cache::FileCache)
BuildRequires: perl(Cache::Memcached)
BuildRequires: perl(CGI)
BuildRequires: perl(Class::Inspector)
BuildRequires: perl(Clone)
BuildRequires: perl(Config::IniFiles)
BuildRequires: perl(constant)
BuildRequires: perl(Convert::Base32)
BuildRequires: perl(Convert::PEM)
BuildRequires: perl(Crypt::OpenSSL::Bignum)
BuildRequires: perl(Crypt::OpenSSL::RSA)
BuildRequires: perl(Crypt::OpenSSL::X509)
BuildRequires: perl(Crypt::Rijndael)
BuildRequires: perl(Data::Dumper)
BuildRequires: perl(DBI)
BuildRequires: perl(Digest::HMAC_SHA1)
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(Digest::SHA)
BuildRequires: perl(Email::Date::Format)
# Not available for EL6
%if ! 0%{?el6}
BuildRequires: perl(Email::Sender)
BuildRequires: perl(Email::Sender::Simple)
BuildRequires: perl(Email::Sender::Transport::SMTP)
%endif
BuildRequires: perl(Encode)
BuildRequires: perl(English)
BuildRequires: perl(Env)
BuildRequires: perl(Exporter)
BuildRequires: perl(ExtUtils::MakeMaker)
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)
BuildRequires: perl(HTML::Template)
BuildRequires: perl(HTTP::Headers)
BuildRequires: perl(HTTP::Request)
BuildRequires: perl(IO::Select)
BuildRequires: perl(IO::Socket::INET)
BuildRequires: perl(IO::String)
BuildRequires: perl(JSON)
BuildRequires: perl(Log::Log4perl)
BuildRequires: perl(LWP::Protocol::https)
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(MIME::Base64)
BuildRequires: perl(MIME::Entity)
BuildRequires: perl(mod_perl2)
BuildRequires: perl(Mouse)
BuildRequires: perl(Net::LDAP)
BuildRequires: perl(Net::LDAP::Extension::SetPassword)
BuildRequires: perl(Net::LDAP::Util)
BuildRequires: perl(Plack)
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)
BuildRequires: perl(Regexp::Assemble)
BuildRequires: perl(Regexp::Common)
BuildRequires: perl(Safe)
BuildRequires: perl(Scalar::Util)
# https://bugzilla.redhat.com/show_bug.cgi?id=1644266
#BuildRequires: perl(Sentry::Raven)
BuildRequires: perl(SOAP::Lite)
BuildRequires: perl(SOAP::Transport::HTTP)
BuildRequires: perl(strict)
BuildRequires: perl(String::Random)
BuildRequires: perl(Sys::Syslog)
BuildRequires: perl(Test::MockObject)
BuildRequires: perl(Test::Pod) >= 1.00
BuildRequires: perl(Time::Local)
BuildRequires: perl(Unicode::String)
BuildRequires: perl(URI)
BuildRequires: perl(URI::Escape)
BuildRequires: perl(URI::URL)
BuildRequires: perl(utf8)
BuildRequires: perl(warnings)
BuildRequires: perl(XML::LibXSLT)
BuildRequires: perl(XML::Simple)
BuildRequires: perl(YAML)
%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires: systemd
%endif
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}
# Setup requires filtering
%if 0%{?rhel} == 6
%filter_from_requires /perl(lasso/d; /perl(Net::OpenID/d; /perl(Web::ID/d; /perl(XML::LibXML/d; /perl(XML::LibXSLT/d; /perl(Sentry::Raven/d;
%filter_from_provides /perl(Lemonldap::NG::Handler::Main/d; /perl(Lemonldap::NG::Manager::Attributes/d; /perlLemonldap::NG::Portal::Main/d;
%filter_setup
%endif
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: lemonldap-ng-doc = %{real_version}-%{release}
Requires: lemonldap-ng-handler = %{real_version}-%{release}
Requires: lemonldap-ng-manager = %{real_version}-%{release}
Requires: lemonldap-ng-portal = %{real_version}-%{release}
Requires: lemonldap-ng-test = %{real_version}-%{release}
%if 0%{?fedora} || 0%{?rhel} >= 7
%{?perl_default_filter}
%global __requires_exclude perl\\(lasso|perl\\(Net::OpenID|perl\\(Web::ID|perl\\(XML::LibXML|perl\\(XML::LibXSLT|perl\\(Sentry::Raven
%global __provides_exclude perl\\(Lemonldap::NG::Handler::Main|perl\\(Lemonldap::NG::Manager::Attributes|perl\\(Lemonldap::NG::Portal::Main
%endif
%description
LemonLdap::NG is a modular Web-SSO based on Apache::Session modules. It
......@@ -116,145 +201,142 @@ So you can have a full AAA protection for your web space as described below.
#==============================================================================
# Conf
#==============================================================================
%package -n lemonldap-ng-conf
%package conf
Summary: LemonLDAP-NG configuration
Requires: perl(Apache::Session)
Requires: perl(IO::String)
Requires: perl(Lemonldap::NG::Common) = %{cpan_common_version}
Requires: perl(Lemonldap::NG::Common) = %{version}-%{release}
Requires: perl(mod_perl2)
%if 0%{?rhl}%{?rhel}%{?fedora}
%if 0%{?rhel}%{?fedora}
Requires(post): httpd
%else
Requires(post): apache2
%endif
#==============================================================================
# Configuration
#==============================================================================
%description -n lemonldap-ng-conf
%description conf
This package contains the main storage configuration.
Requires: perl(Apache::Session)
Requires: perl(IO::String)
Requires: perl(Lemonldap::NG::Common) = %{cpan_common_version}
Requires: perl(mod_perl2)
%if 0%{?rhl}%{?rhel}%{?fedora}
Requires(post): httpd
%else
Requires(post): apache2
%endif
#==============================================================================
# Documentation
#==============================================================================
%package -n lemonldap-ng-doc
%package doc
Summary: LemonLDAP-NG documentation
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: lemonldap-ng-conf = %{version}-%{release}
%description -n lemonldap-ng-doc
This package contains html documentation.
%description doc
This package contains HTML documentation.
#==============================================================================
# Handler
#==============================================================================
%package -n lemonldap-ng-handler
%package handler
Summary: LemonLDAP-NG handler
%if 0%{?rhl}%{?rhel}%{?fedora}
%if 0%{?rhel}%{?fedora}
Requires: crontabs
%endif
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: perl(Lemonldap::NG::Handler) = %{cpan_handler_version}
Requires: lemonldap-ng-conf = %{version}-%{release}
Requires: perl(Lemonldap::NG::Handler) = %{version}-%{release}
%description -n lemonldap-ng-handler
%description handler
This package deploys the Apache Handler.
#==============================================================================
# Manager
#==============================================================================
%package -n lemonldap-ng-manager
%package manager
Summary: LemonLDAP-NG administration interface
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: perl(Lemonldap::NG::Manager) = %{cpan_manager_version}
Requires: lemonldap-ng-conf = %{version}-%{release}
Requires: perl(Lemonldap::NG::Manager) = %{version}-%{release}
%description -n lemonldap-ng-manager
This package deploys the adminsitration interface and sessions explorer.
%description manager
This package deploys the administration interface and sessions explorer.
#==============================================================================
# Portal
#==============================================================================
%package -n lemonldap-ng-portal
%package portal
Summary: LemonLDAP-NG authentication portal
%if 0%{?rhl}%{?rhel}%{?fedora}
%if 0%{?rhel}%{?fedora}
Requires: crontabs
%endif
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: perl(Lemonldap::NG::Portal) = %{cpan_portal_version}
Requires: lemonldap-ng-conf = %{version}-%{release}
Requires: perl(Lemonldap::NG::Portal) = %{version}-%{release}
%description -n lemonldap-ng-portal
%description portal
This package deploys the authentication portal.
#==============================================================================
# Test
#==============================================================================
%package -n lemonldap-ng-test
%package test
Summary: LemonLDAP-NG test applications
Requires: lemonldap-ng-conf = %{real_version}-%{release}
Requires: lemonldap-ng-conf = %{version}-%{release}
%description -n lemonldap-ng-test
%description test
This package deploys small test applications.
#==============================================================================
# FastCGI Server
#==============================================================================
%package -n lemonldap-ng-fastcgi-server
%package fastcgi-server
Summary: LemonLDAP-NG FastCGI Server
Requires: lemonldap-ng-conf = %{real_version}-%{release}
%if 0%{?rhl}%{?rhel}%{?fedora}
Requires: lemonldap-ng-conf = %{version}-%{release}
%if 0%{?rhel}%{?fedora}
Requires: mod_fcgid
%else
Requires: apache2-mod_fcgid
%endif
Requires: perl(FCGI::ProcManager)
%description -n lemonldap-ng-fastcgi-server
%description fastcgi-server
This package deploys files needed to start a FastCGI server.
#==============================================================================
# UWSGI Application
#==============================================================================
%package -n lemonldap-ng-uwsgi-app
%package uwsgi-app
Summary: LemonLDAP-NG UWSGI Application
Requires: uwsgi-plugin-psgi
Requires: uwsgi-plugin-psgi
%description -n lemonldap-ng-uwsgi-app
%description uwsgi-app
LemonLDAP::NG uWSGI server provides a replacement to LemonLDAP::NG FastCGI
server, using uWSGI instead of Plack FCGI.
#==============================================================================
# Nginx server
#==============================================================================
%package nginx
Summary: LemonLDAP-NG Nginx support
Requires: nginx
%description nginx
Nginx support for LemonLDAP::NG.
#==============================================================================
# CPAN modules - Common
#==============================================================================
%package -n perl-Lemonldap-NG-Common
Summary: LemonLDAP-NG Common Modules
Version: %{cpan_common_version}
%description -n perl-Lemonldap-NG-Common
This package installs the configuration libraries used by other LemonLDAP::NG modules.
This package installs the configuration libraries used by other LemonLDAP::NG
modules.
#==============================================================================
# CPAN modules - Handler
#==============================================================================
%package -n perl-Lemonldap-NG-Handler
Summary: LemonLDAP-NG Handler Modules
Version: %{cpan_handler_version}
%description -n perl-Lemonldap-NG-Handler
This package installs the Apache module part (handler) used to protect web areas.
This package installs the Apache module part (handler) used to protect web
areas.
#==============================================================================
# CPAN modules - Manager
#==============================================================================
%package -n perl-Lemonldap-NG-Manager
Summary: LemonLDAP-NG Manager Modules
Version: %{cpan_manager_version}
%description -n perl-Lemonldap-NG-Manager
This package installs the administration interface (manager).
......@@ -264,7 +346,6 @@ This package installs the administration interface (manager).
#==============================================================================
%package -n perl-Lemonldap-NG-Portal
Summary: LemonLDAP-NG Portal Modules
Version: %{cpan_portal_version}
%description -n perl-Lemonldap-NG-Portal
This package installs the authentication portal.
......@@ -273,34 +354,16 @@ This package installs the authentication portal.
# Source preparation
#==============================================================================
%prep
%setup -n %{real_name}-%{real_version} -q
# Remove unwanted provides/requires
%setup -q -n %{name}-%{version}%{?pre_release:~%{pre_release}}
cat << \EOF > %{name}-req
#!/bin/sh
%{__perl_requires} $* |\
sed -e '/perl(lasso)/d' |\
sed -e '/perl(Net::OpenID::Consumer)/d' |\
sed -e '/perl(Net::OpenID::Server)/d' |\
sed -e '/perl(Web::ID)/d' |\
sed -e '/perl(XML::LibXML)/d' |\
sed -e '/perl(XML::LibXSLT)/d'
EOF
%define __perl_requires %{_builddir}/%{name}-%{real_version}/%{name}-req
chmod +x %{__perl_requires}
%if 0%{?rhel} >= 7
%{?perl_default_filter}
%global __requires_exclude perl\\(lasso|perl\\(Net::OpenID|perl\\(Web::ID|perl\\(XML::LibXML|perl\\(XML::LibXSLT|perl\\(Convert::Base32|perl\\(Sentry::Raven
%endif
#==============================================================================
# Building
#==============================================================================
%build
%{__make} %{?_smp_mflags} configure STORAGECONFFILE=%{lm_storagefile} PERLOPTIONS="INSTALLDIRS=vendor"
%{__make} %{?_smp_mflags} configure \
STORAGECONFFILE=%{lm_storagefile} \
PERLOPTIONS="INSTALLDIRS=vendor"
%{__make} %{?_smp_mflags}
#==============================================================================
......@@ -308,27 +371,27 @@ chmod +x %{__perl_requires}
#============================================================================
%install
%{__make} %{?_smp_mflags} install \
DESTDIR=%{buildroot} \
PREFIX=%{lm_prefix} \
BINDIR=%{lm_sharedir}/bin \
SBINDIR=%{lm_sharedir}/sbin \
FASTCGISOCKDIR=/var/run/llng-fastcgi-server \
DOCUMENTROOT=%{lm_vardir} \
EXAMPLESDIR=%{lm_examplesdir} \
HANDLERDIR=%{lm_vardir}/handler \
MANAGERDIR=%{lm_sharedir}/manager \
STORAGECONFFILE=%{lm_storagefile} \
TOOLSDIR=%{lm_sharedir}/ressources \
CONFDIR=%{lm_confdir} \
CRONDIR=%{_sysconfdir}/cron.d \
DATADIR=%{lm_vardir} \
INITDIR=/etc/init.d \
ETCDEFAULTDIR=/etc/default \
DNSDOMAIN=%{lm_dnsdomain} \
APACHEVERSION=%{apache_version} \
UWSGIYAMLDIR=/etc/uwsgi/apps-available \
LLNGAPPDIR=%{lm_sharedir}/llng-server \
PROD=yes
DESTDIR=%{buildroot} \
PREFIX=%{lm_prefix} \
BINDIR=%{lm_bindir} \
SBINDIR=%{lm_sbindir} \
FASTCGISOCKDIR=%{_rundir}/llng-fastcgi-server \
DOCUMENTROOT=%{lm_sharedir} \
EXAMPLESDIR=%{lm_examplesdir} \
HANDLERDIR=%{lm_sharedir}/handler \
MANAGERDIR=%{lm_sharedir}/manager \
STORAGECONFFILE=%{lm_storagefile} \
TOOLSDIR=%{lm_sharedir}/ressources \
CONFDIR=%{lm_confdir} \
CRONDIR=%{_sysconfdir}/cron.d \
DATADIR=%{lm_vardir} \
INITDIR=%{_sysconfdir}/init.d \
ETCDEFAULTDIR=%{_sysconfdir}/default \
DNSDOMAIN=%{lm_dnsdomain} \
APACHEVERSION=%{apache_version} \
UWSGIYAMLDIR=%{_sysconfdir}/uwsgi/apps-available \
LLNGAPPDIR=%{lm_sharedir}/llng-server \
PROD=yes
# Remove some unwanted files
find %{buildroot} -name .packlist -exec rm -f {} \;
......@@ -337,19 +400,25 @@ find %{buildroot} -name *.bak -exec rm -f {} \;
# Install files for FastCGI Server
mkdir -p %{buildroot}%{_unitdir}
install -m644 fastcgi-server/systemd/llng-fastcgi-server.service %{buildroot}%{_unitdir}
sed -i 's:__FASTCGISOCKDIR__:/var/run/llng-fastcgi-server:' %{buildroot}%{_unitdir}/llng-fastcgi-server.service
sed -i 's:__SBINDIR__:/usr/share/lemonldap-ng/sbin:' %{buildroot}%{_unitdir}/llng-fastcgi-server.service
rm -f %{buildroot}/etc/init.d/llng-fastcgi-server
install -m644 fastcgi-server/systemd/llng-fastcgi-server.service \
%{buildroot}%{_unitdir}
sed -i \
-e 's:__FASTCGISOCKDIR__:%{_rundir}/llng-fastcgi-server:' \
-e 's:__SBINDIR__:%{lm_sbindir}:' \
%{buildroot}%{_unitdir}/llng-fastcgi-server.service
rm -f %{buildroot}%{_sysconfdir}/init.d/llng-fastcgi-server
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m644 fastcgi-server/systemd/llng-fastcgi-server.tmpfile %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
sed -i 's:__FASTCGISOCKDIR__:/var/run/llng-fastcgi-server:' %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
sed -i 's:__USER__:%{lm_apacheuser}:' %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
sed -i 's:__GROUP__:%{lm_apachegroup}:' %{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
install -m644 fastcgi-server/systemd/llng-fastcgi-server.tmpfile \
%{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
sed -i \
-e 's:__FASTCGISOCKDIR__:%{_rundir}/llng-fastcgi-server:' \
-e 's:__USER__:%{lm_apacheuser}:' \
-e 's:__GROUP__:%{lm_apachegroup}:' \
%{buildroot}%{_tmpfilesdir}/llng-fastcgi-server.conf
# UWSGI Application
mkdir -p %{buildroot}/etc/uwsgi/apps-available
mkdir -p %{buildroot}%{_sysconfdir}/uwsgi/apps-available
mkdir -p %{buildroot}%{lm_sharedir}/llng-server
# Set apache user in some files (see Makefile)
......@@ -357,9 +426,12 @@ mkdir -p %{buildroot}%{lm_sharedir}/llng-server
# because it launches a 'chown', which is not permitted if RPM is not
# built as root
sed -i 's/nobody/%{lm_apacheuser}/' %{buildroot}%{_sysconfdir}/cron.d/*
sed -i 's/nobody/%{lm_apacheuser}/' %{buildroot}%{lm_sharedir}/bin/lmConfigEditor
sed -i 's/nobody/%{lm_apacheuser}/g' %{buildroot}%{lm_sharedir}/bin/lemonldap-ng-cli
sed -i 's/nobody/%{lm_apacheuser}/g' %{buildroot}/etc/default/llng-fastcgi-server
sed -i 's/nobody/%{lm_apacheuser}/' \
%{buildroot}%{lm_bindir}/lmConfigEditor
sed -i 's/nobody/%{lm_apacheuser}/g' \
%{buildroot}%{lm_bindir}/lemonldap-ng-cli
sed -i 's/nobody/%{lm_apacheuser}/g' \
%{buildroot}%{_sysconfdir}/default/llng-fastcgi-server
# Set UNIX rights
mkdir -p %{buildroot}%{lm_vardir}/sessions/lock
......@@ -373,50 +445,61 @@ chmod 770 %{buildroot}%{lm_vardir}/psessions
chmod 770 %{buildroot}%{lm_vardir}/psessions/lock
chmod 770 %{buildroot}%{lm_vardir}/notifications
chmod 770 %{buildroot}%{lm_vardir}/captcha
chmod 775 %{buildroot}%{lm_sharedir}/sbin/llng-fastcgi-server
# Touch for ghost
mkdir -p %buildroot%{apache_confdir}
touch %buildroot%{apache_confdir}/z-lemonldap-ng-handler.conf
touch %buildroot%{apache_confdir}/z-lemonldap-ng-manager.conf
touch %buildroot%{apache_confdir}/z-lemonldap-ng-portal.conf
touch %buildroot%{apache_confdir}/z-lemonldap-ng-test.conf
chmod 775 %{buildroot}%{lm_sbindir}/llng-fastcgi-server
# 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
# Install nginx conf files
mkdir -p %{buildroot}%{_sysconfdir}/nginx/conf.d/
mv %{buildroot}%{lm_confdir}/*nginx*.conf \
%{buildroot}%{_sysconfdir}/nginx/conf.d/
# Remove for_etc_hosts from %%{_sysconfdir}
mv %{buildroot}%{lm_confdir}/for_etc_hosts .
# 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
#==============================================================================
# Run test
#==============================================================================
%check
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}
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}
#==============================================================================
# Post Installation
#==============================================================================
%post -n lemonldap-ng-conf
# Create symlink in Apache configuration
# We use "z-lemonldap-ng-*" so that Apache read the files after "perl.conf"
if [ ! -e %{apache_confdir}/z-lemonldap-ng-handler.conf ] ; then
ln -s %{lm_confdir}/handler-apache%{apache_version}.conf %{apache_confdir}/z-lemonldap-ng-handler.conf || :
fi
if [ ! -e %{apache_confdir}/z-lemonldap-ng-manager.conf ] ; then
ln -s %{lm_confdir}/manager-apache%{apache_version}.conf %{apache_confdir}/z-lemonldap-ng-manager.conf || :
fi
if [ ! -e %{apache_confdir}/z-lemonldap-ng-portal.conf ] ; then
ln -s %{lm_confdir}/portal-apache%{apache_version}.conf %{apache_confdir}/z-lemonldap-ng-portal.conf || :
fi
if [ ! -e %{apache_confdir}/z-lemonldap-ng-test.conf ] ; then
ln -s %{lm_confdir}/test-apache%{apache_version}.conf %{apache_confdir}/z-lemonldap-ng-test.conf || :
fi
%post conf
# Upgrade from previous version
# See http://lemonldap-ng.org/documentation/1.0/upgrade
if [ $1 -gt 1 ] ; then
if [ -e %{lm_confdir}/storage.conf -o -e %{lm_confdir}/apply.conf -o -e %{lm_confdir}/apps-list.xml ] ; then
# Run migration script
%{lm_sharedir}/bin/lmMigrateConfFiles2ini 2>&1 > /dev/null || :
# Fix ownership
chgrp %{lm_apachegroup} %{lm_storagefile} || :
fi
if [ -e %{lm_confdir}/storage.conf \
-o -e %{lm_confdir}/apply.conf \
-o -e %{lm_confdir}/apps-list.xml ] ; then
# Run migration script
%{lm_bindir}/lmMigrateConfFiles2ini 2>&1 > /dev/null || :
# Fix ownership
chgrp %{lm_apachegroup} %{lm_storagefile} || :
fi
fi
# Set editor alternatives if it does not exist
update-alternatives --display editor > /dev/null 2>&1
......@@ -427,140 +510,128 @@ fi
#==============================================================================
# Pre uninstallation
#==============================================================================
%preun -n lemonldap-ng-conf
# Package removal
if [ $1 -eq 0 ] ; then
# Remove symlink in Apache configuration
rm -f %{apache_confdir}/z-lemonldap-ng-handler.conf 2>&1 > /dev/null || :
rm -f %{apache_confdir}/z-lemonldap-ng-manager.conf 2>&1 > /dev/null || :
rm -f %{apache_confdir}/z-lemonldap-ng-portal.conf 2>&1 > /dev/null || :
rm -f %{apache_confdir}/z-lemonldap-ng-test.conf 2>&1 > /dev/null || :
fi
%preun conf
# Upgrade from previous version
if [ $1 -eq 1 ] ; then
# Remove old symlink in Apache configuration
rm -f %{apache_confdir}/z-lemonldap-ng.conf 2>&1 > /dev/null || :
# Remove old symlinks in Apache configuration
rm -f %{apache_confdir}/z-lemonldap-ng*.conf 2>&1 > /dev/null || :
fi
%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
%files
%defattr(-,root,root,-)
%doc changelog COPYING INSTALL README.md
%files -n lemonldap-ng-conf
%defattr(-,root,root,-)
%files conf
%doc changelog INSTALL README.md AUTHORS CONTRIBUTING.md
%doc for_etc_hosts
%license COPYING GPL
%dir %{lm_confdir}
%config %{lm_confdir}/for_etc_hosts
%config(noreplace) %{lm_confdir}/handler-apache%{apache_version}.conf
%config(noreplace) %{lm_confdir}/manager-apache%{apache_version}.conf
%config(noreplace) %{lm_confdir}/portal-apache%{apache_version}.conf
%config(noreplace) %{lm_confdir}/test-apache%{apache_version}.conf
%config(noreplace) %{lm_confdir}/handler-nginx.conf
%config(noreplace) %{lm_confdir}/manager-nginx.conf
%config(noreplace) %{lm_confdir}/nginx-lmlog.conf
%config(noreplace) %{lm_confdir}/nginx-lua-headers.conf
%config(noreplace) %{lm_confdir}/portal-nginx.conf
%config(noreplace) %{lm_confdir}/test-nginx.conf
%ghost %{apache_confdir}/z-lemonldap-ng-handler.conf
%ghost %{apache_confdir}/z-lemonldap-ng-manager.conf
%ghost %{apache_confdir}/z-lemonldap-ng-portal.conf
%ghost %{apache_confdir}/z-lemonldap-ng-test.conf
%dir %{lm_vardir}
%dir %{lm_sharedir}
%dir %{lm_sharedir}/bin
%{lm_sharedir}/bin/convertConfig
%doc %{_mandir}/man1/convertConfig*
%{lm_sharedir}/bin/importMetadata
%{lm_sharedir}/bin/lmMigrateConfFiles2ini
%{lm_sharedir}/bin/rotateOidcKeys
%config(noreplace) %attr(-,root,%{lm_apachegroup}) %{lm_storagefile}
%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
%{_mandir}/man1/convertConfig*
%dir %{_libexecdir}/%{name}
%dir %{lm_sbindir}
%dir %{lm_bindir}
%{lm_bindir}/convertConfig
%{lm_bindir}/importMetadata
%{lm_bindir}/lmMigrateConfFiles2ini
%{lm_bindir}/rotateOidcKeys
%dir %{lm_examplesdir}
%dir %{lm_sharedir}/ressources
%{lm_sharedir}/ressources/*
%defattr(-,root,%{lm_apachegroup},-)
%config(noreplace) %{lm_storagefile}
%defattr(750,%{lm_apacheuser},%{lm_apachegroup},-)
%dir %{lm_sharedir}
%{lm_sharedir}/ressources/
%dir %{lm_vardir}
%defattr(640,%{lm_apacheuser},%{lm_apachegroup},750)
%dir %{lm_vardir}/conf
%dir %{lm_vardir}/sessions
%dir %{lm_vardir}/sessions/lock
%dir %{lm_vardir}/psessions
%dir %{lm_vardir}/psessions/lock
%dir %{lm_vardir}/notifications
%defattr(640,%{lm_apacheuser},%{lm_apachegroup},-)
%config(noreplace) %{lm_vardir}/conf/lmConf-1.json
%files -n lemonldap-ng-doc
%defattr(-,root,root,-)
%doc %{lm_vardir}/doc
%doc changelog COPYING INSTALL README.md
%files doc
%doc %{lm_sharedir}/doc
%doc changelog INSTALL README.md AUTHORS CONTRIBUTING.md
%license COPYING GPL
%files -n lemonldap-ng-handler
%defattr(-,root,root,-)
%{lm_sharedir}/bin/purgeLocalCache
%{_sysconfdir}/cron.d/lemonldap-ng-handler
%{lm_vardir}/handler
%files handler
%{lm_bindir}/purgeLocalCache
%config(noreplace) %{_sysconfdir}/cron.d/lemonldap-ng-handler
%{lm_sharedir}/handler
%{lm_examplesdir}/handler
%{lm_sharedir}/llng-server/llng-server.psgi
%files -n lemonldap-ng-manager
%defattr(-,root,root,-)
%files manager
%{lm_sharedir}/manager
%{lm_examplesdir}/manager
%{lm_sharedir}/bin/lmConfigEditor
%{lm_sharedir}/bin/lemonldap-ng-cli
%doc %{_mandir}/man1/lemonldap-ng-cli*
%files -n lemonldap-ng-portal
%defattr(-,root,root,-)
%{lm_vardir}/portal
%{lm_sharedir}/bin/purgeCentralCache