Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=ryuotesting2.git;a=commitdiff;h=6a9420479f0b43ce97cf4a985b70867204e6096d

commit 6a9420479f0b43ce97cf4a985b70867204e6096d
Author: James Buren <[email protected]>
Date:   Sun Jun 10 19:18:21 2012 -0500

openldap-2.4.31-1-x86_64
* convert to systemd schema

diff --git a/source/network-extra/openldap/FrugalBuild 
b/source/network-extra/openldap/FrugalBuild
index bf7dd59..978726a 100644
--- a/source/network-extra/openldap/FrugalBuild
+++ b/source/network-extra/openldap/FrugalBuild
@@ -2,8 +2,8 @@
# Maintainer: Miklos Vajna <[email protected]>

pkgname=openldap
-pkgver=2.4.28
-pkgrel=2
+pkgver=2.4.31
+pkgrel=1
pkgdesc="A suite of the Lightweight Directory Access Protocol servers"
url="http://www.openldap.org/";
groups=('network-extra')
@@ -14,9 +14,10 @@ rodepends=("libldap=$pkgver")
makedepends=('openssl>=1.0.0' 'cyrus-sasl>=2.1.23-4' 'groff')
up2date="lynx -dump http://www.openldap.org/software/download/|grep 'United 
States'|sed -e 's/.*]\(.*\) \[.*/\1/'"
source=(ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/$pkgname-$pkgver.tgz
 rc.slapd \
-       slapd.sysconfig create_initial_ldap slapd.init.ldif slapd.init.conf 
DB_CONFIG)
-sha1sums=('d888beae1723002a5a2ff5509d3040df40885774' \
+       slapd.service slapd.sysconfig create_initial_ldap slapd.init.ldif 
slapd.init.conf DB_CONFIG)
+sha1sums=('8315a283fb3724abe6062e38d93bb69298d05765' \
'cedff3902bc2169d76f7f314bbfec1e39759515a' \
+          '01796e95dfc853b789f41a908ab340fa4e2334d4' \
'fe4a47065a0b3b7c61d768dd5216b28f1254ffb0' \
'31d5ecdba5d490763fb06df5452cb48157a73871' \
'5fc92cf30d4826be94e2ef421a951f49849dbe3c' \
@@ -29,6 +30,11 @@ subdepends=('openssl>=1.0.0 cyrus-sasl')
subgroups=('lib')
subarchs=('i686 x86_64 arm')

+_F_systemd_scriptlet="$pkgname.install"
+_F_sysvinit_units=(slapd)
+_F_systemd_units=(slapd=)
+Finclude systemd
+
build()
{
Fcd
@@ -61,11 +67,14 @@ build()
Ffile /usr/share/openldap/slapd.init.conf
Ffile /usr/share/openldap/DB_CONFIG
Fexe /usr/bin/create_initial_ldap
+       Ffile /lib/systemd/system/slapd.service

Fsplit libldap etc/openldap/ldap.conf*
Fsplit libldap usr/include
Fsplit libldap usr/lib/libldap*
Fsplit libldap usr/lib/liblber*
+
+       Fgenscriptlet
}

# optimization OK
diff --git a/source/network-extra/openldap/openldap.install 
b/source/network-extra/openldap/openldap.install
index f302eee..e45cbdc 100644
--- a/source/network-extra/openldap/openldap.install
+++ b/source/network-extra/openldap/openldap.install
@@ -1,3 +1,6 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
post_install()
{
[ -z "`grep '^openldap:' /etc/group`" ] && \
@@ -5,30 +8,68 @@ post_install()
[ -z "`grep '^openldap:' /etc/passwd`" ] && \
useradd -M -u 49 -d /var/openldap/openldap-data -r -s /bin/false -g openldap 
openldap

-       chown openldap var/openldap/openldap-data
-       chgrp openldap var/openldap/openldap-data
-       chown openldap var/openldap/run
-       chgrp openldap var/openldap/run
-}
+       chown -R openldap:openldap var/openldap
+       chown -R openldap:openldap etc/openldap

-pre_upgrade()
-{
-       [ -e /lib/initscripts/functions ] && /sbin/service slapd stop
+       local unit
+       local op
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               op=$(echo $i | cut -f 2 -d '=')
+               if echo $op | grep -q 'e'; then
+                       systemctl enable $unit.service >/dev/null 2>&1
+               fi
+               if echo $op | grep -q 's'; then
+                       systemctl start $unit.service >/dev/null 2>&1
+               fi
+       done
}

post_upgrade()
{
-       post_install $1
+       [ -z "`grep '^openldap:' /etc/group`" ] && \
+               groupadd -g 49 openldap >& /dev/null
+       [ -z "`grep '^openldap:' /etc/passwd`" ] && \
+               useradd -M -u 49 -d /var/openldap/openldap-data -r -s 
/bin/false -g openldap openldap
+
+       chown -R openldap:openldap var/openldap
+       chown -R openldap:openldap etc/openldap
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       systemctl daemon-reload >/dev/null 2>&1
}

pre_remove()
{
-       [ -e /lib/initscripts/functions ] && /sbin/service slapd stop
userdel openldap &> /dev/null
groupdel openldap &> /dev/null
+
+       local unit
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       for i in ${systemd_units[@]}; do
+               unit=$(echo $i | cut -f 1 -d '=')
+               systemctl --no-reload disable $unit.service >/dev/null 2>&1
+               systemctl stop $unit.service >/dev/null 2>&1
+       done
+}
+
+post_remove()
+{
+       systemctl daemon-reload >/dev/null 2>&1
}

op=$1
shift
-
$op $*
diff --git a/source/network-extra/openldap/slapd.service 
b/source/network-extra/openldap/slapd.service
new file mode 100644
index 0000000..c32c900
--- /dev/null
+++ b/source/network-extra/openldap/slapd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=OpenLDAP
+After=network.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/slapd
+ExecStart=/usr/libexec/slapd -u $SLAPD_USER -g $SLAPD_GROUP
+PIDFile=/var/openldap/run/slapd.pid
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to