ipfire-3.x/openldap/openldap.nm

163 lines
4.2 KiB
Plaintext

###############################################################################
# IPFire.org - An Open Source Firewall Solution #
# Copyright (C) - IPFire Development Team <info@ipfire.org> #
###############################################################################
name = openldap
version = 2.4.44
release = 1
groups = System/Daemons
url = http://www.openldap.org/
license = OpenLDAP
summary = LDAP support libraries.
description
OpenLDAP is an open source suite of LDAP (Lightweight Directory Access
Protocol) applications and development tools. LDAP is a set of
protocols for accessing directory services over the Internet, similar
to the way DNS information is propagated over the Internet. The
openldap package contains configuration files, libraries, and
documentation for OpenLDAP.
end
source_dl = ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/
sources = %{thisapp}.tgz
build
requires
automake
cyrus-sasl-devel
groff
# Cannot be built with libdb 6 and above
# because of an incompatibility with AGPL
libdb-devel < 6
libtool
libtool-devel
openssl-devel
pth-devel
shadow-utils
end
configure_options += \
--libexecdir=%{libdir} \
--with-threads=posix \
--disable-perl \
--enable-dynamic \
--enable-crypt \
--enable-modules \
--enable-rlookups \
--enable-backends=mod \
--enable-overlays=mod \
--enable-sql=no \
--enable-ndb=no \
--enable-hdb=yes \
--enable-monitor=yes \
--disable-static
prepare_cmds
%{create_user}
end
install_cmds
mv -v %{BUILDROOT}%{libdir}/slapd %{BUILDROOT}/usr/sbin/slapd
ln -svf slapd %{BUILDROOT}/usr/sbin/slapacl
ln -svf slapd %{BUILDROOT}/usr/sbin/slapadd
ln -svf slapd %{BUILDROOT}/usr/sbin/slapauth
ln -svf slapd %{BUILDROOT}/usr/sbin/slapcat
ln -svf slapd %{BUILDROOT}/usr/sbin/slapdn
ln -svf slapd %{BUILDROOT}/usr/sbin/slapindex
ln -svf slapd %{BUILDROOT}/usr/sbin/slappasswd
ln -svf slapd %{BUILDROOT}/usr/sbin/slapschema
ln -svf slapd %{BUILDROOT}/usr/sbin/slaptest
# Remove unneeded files.
rm -rvf %{BUILDROOT}%{sysconfidir}/slapd.{conf,ldif}
rm -rvf %{BUILDROOT}%{localstatedir}/openldap-data
rm -rvf %{BUILDROOT}%{localstatedir}/run
for LINK in lber ldap ldap_r; do
chmod -v 0755 %{BUILDROOT}%{libdir}/$(readlink %{BUILDROOT}%{libdir}/lib${LINK}.so)
done
# Install configuration file.
mkdir -pv %{BUILDROOT}%{datadir}/%{name}
cp -vf %{DIR_SOURCE}/openldap-conf.ldif \
%{BUILDROOT}%{datadir}/%{name}/
# Install ldapcert.sh script.
install -m 0755 %{DIR_SOURCE}/ldapcert.sh \
%{BUILDROOT}%{datadir}/%{name}/
# Create directoires.
mkdir -pv %{BUILDROOT}%{sysconfdir}/%{name}/slapd.d
mkdir -pv %{BUILDROOT}%{sysconfdir}/%{name}/certs
mkdir -pv %{BUILDROOT}/run/%{name}
mkdir -pv %{BUILDROOT}%{sharedstatedir}/ldap
# Fix permissions and ownerships.
chown -Rv ldap:ldap %{BUILDROOT}%{sysconfdir}/%{name}
chown ldap:ldap %{BUILDROOT}/run/%{name}
chown ldap:ldap %{BUILDROOT}%{sharedstatedir}/ldap
chmod 700 -Rv %{BUILDROOT}%{sharedstatedir}/ldap
end
end
create_user
getent group ldap >/dev/null || groupadd -r ldap
getent passwd ldap >/dev/null || useradd -r -g ldap \
-d /var/lib/ldap -s /sbin/nologin -c "OpenLDAP server" ldap
end
packages
package %{name}
prerequires
openssl
shadow-utils
end
script prein
%{create_user}
end
datafiles
%{sysconfdir}/%{name}/slapd.d
%{sysconfdir}/%{name}/certs
%{sharedstatedir}/ldap
end
script postin
systemctl daemon-reload >/dev/null 2>&1 || :
systemctl enable openldap.socket >/dev/null 2>&1 || :
end
script preun
systemctl --no-reload disable openldap.service >/dev/null 2>&1 || :
systemctl --no-reload disable openldap.socket >/dev/null 2>&1 || :
systemctl stop openldap.service >/dev/null 2>&1 || :
systemctl stop openldap.socket >/dev/null 2>&1 || :
end
script postun
systemctl daemon-reload >/dev/null 2>&1 || :
end
script postup
systemctl daemon-reload >/dev/null 2>&1 || :
systemctl try-restart openldap.service >/dev/null 2>&1 || :
end
end
package %{name}-libs
template LIBS
end
package %{name}-devel
template DEVEL
end
package %{name}-debuginfo
template DEBUGINFO
end
end