new ebuild, 389 Directory Server server package, thanks to Andreis_Vinogradovs (...
authorFabio Erculiani <lxnay@gentoo.org>
Wed, 7 Jul 2010 14:31:36 +0000 (14:31 +0000)
committerFabio Erculiani <lxnay@gentoo.org>
Wed, 7 Jul 2010 14:31:36 +0000 (14:31 +0000)
Package-Manager: portage-2.2_rc67/cvs/Linux x86_64

net-nds/389-ds-base/389-ds-base-1.2.6_rc3.ebuild [new file with mode: 0644]
net-nds/389-ds-base/ChangeLog [new file with mode: 0644]
net-nds/389-ds-base/Manifest [new file with mode: 0644]
net-nds/389-ds-base/files/1.2.6/selinux_gentoo.patch [new file with mode: 0644]
net-nds/389-ds-base/files/1.2.6/selinux_makefile.patch [new file with mode: 0644]
net-nds/389-ds-base/files/389-ds-snmp.initd [new file with mode: 0644]
net-nds/389-ds-base/files/389-ds.initd [new file with mode: 0644]
net-nds/389-ds-base/files/restart-dirsrv [new file with mode: 0644]
net-nds/389-ds-base/files/start-dirsrv [new file with mode: 0644]
net-nds/389-ds-base/metadata.xml [new file with mode: 0644]

diff --git a/net-nds/389-ds-base/389-ds-base-1.2.6_rc3.ebuild b/net-nds/389-ds-base/389-ds-base-1.2.6_rc3.ebuild
new file mode 100644 (file)
index 0000000..49a55e2
--- /dev/null
@@ -0,0 +1,190 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/389-ds-base/389-ds-base-1.2.6_rc3.ebuild,v 1.1 2010/07/07 14:31:36 lxnay Exp $
+
+EAPI=2
+
+WANT_AUTOMAKE="1.9"
+MY_P=${P/_alpha/.a}
+MY_P=${MY_P/_rc/.rc}
+inherit eutils multilib flag-o-matic autotools
+
+DESCRIPTION="389 Directory Server (core librares and daemons )"
+HOMEPAGE="http://port389.org/"
+SRC_URI="http://directory.fedoraproject.org/sources/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2-with-exceptions"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="autobind auto-dn-suffix debug doc +pam-passthru +dna +ldapi +bitwise +presence kerberos selinux"
+
+ALL_DEPEND="dev-libs/nss[utils]
+       dev-libs/nspr
+       dev-libs/svrcore
+       dev-libs/mozldap
+       >=dev-libs/cyrus-sasl-2.1.19
+       >=dev-libs/icu-3.4
+       >=sys-libs/db-4.5
+       >=net-analyzer/net-snmp-5.1.2
+       dev-libs/openssl
+       sys-apps/tcp-wrappers
+       sys-libs/pam
+       sys-libs/zlib
+       dev-perl/perl-mozldap
+       dev-libs/libpcre:3
+       kerberos? ( net-nds/openldap
+               >=app-crypt/mit-krb5-1.7-r100[ldap] )
+       selinux? ( >=sys-apps/policycoreutils-1.30.30
+               sec-policy/selinux-base-policy )"
+
+DEPEND="${ALL_DEPEND}
+       dev-util/pkgconfig
+       sys-devel/libtool:1.5
+       doc? ( app-doc/doxygen )
+       selinux? ( sys-devel/m4 >=sys-apps/checkpolicy-1.30.12 )
+       sys-apps/sed"
+RDEPEND="${ALL_DEPEND}
+       virtual/perl-Time-Local
+       virtual/perl-MIME-Base64"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+       enewgroup dirsrv
+       enewuser dirsrv -1 -1 -1 dirsrv
+}
+
+src_prepare() {
+
+       # as per 389 documentation, when 64bit, export USE_64
+       use amd64 && export USE_64=1
+
+       sed -i -e 's/nobody/dirsrv/g' configure.ac || die "sed failed on configure.ac"
+       use selinux && epatch "${FILESDIR}/1.2.6"/*selinux*.patch
+       eautoreconf
+
+       # enable nsslapd-allow-unauthenticated-binds by default
+       sed -i '/^nsslapd-allow-unauthenticated-binds/ s/off/on/' "${S}"/ldap/ldif/template-dse.ldif.in || \
+               die "cannot tweak default setting: nsslapd-allow-unauthenticated-binds"
+
+}
+
+src_configure() {
+       local myconf=""
+
+       use auto-dn-suffix && myconf="${myconf} --enable-auto-dn-suffix"
+       use selinux && myconf="${myconf} --with-selinux"
+
+       econf \
+               $(use_enable debug) \
+               $(use_enable pam-passthru) \
+               $(use_enable ldapi) \
+               $(use_enable autobind) \
+               $(use_enable dna) \
+               $(use_enable bitwise) \
+               $(use_enable presence) \
+               $(use_with kerberos) \
+               --enable-maintainer-mode \
+               --enable-autobind \
+               --with-fhs \
+               $myconf || die "econf failed"
+}
+
+src_compile() {
+       append-lfs-flags
+
+       # Use -j1 otherwise libacl-plugin.so could fail to install properly
+       emake -j1 || die "compile failed"
+       if use selinux; then
+               emake -f selinux/Makefile || die " build selinux policy failed"
+       fi
+}
+
+src_install () {
+       # Use -j1 otherwise libacl-plugin.so could fail to install properly
+       emake -j1 DESTDIR="${D}" install || die "emake install failed"
+
+       if use selinux;then
+               emake -f selinux/Makefile DESTDIR="${D}" install || die "Install selinux policy failed"
+       fi
+
+       # install not installed header
+       insinto /usr/include/dirsrv
+       doins ldap/servers/slapd/slapi-plugin.h
+
+       # for build free-ipa require winsync-plugin
+       doins ldap/servers/plugins/replication/winsync-plugin.h
+
+       # make sure perl scripts have a proper shebang
+       cd "${D}"/usr/share/dirsrv/script-templates/
+
+       for i in $(find ./  -iname '*.pl') ;do
+               sed -i -e 's/#{{PERL-EXEC}}/#\!\/usr\/bin\/perl/' $i || die
+       done
+
+       # remove redhat style init script
+       rm -rf "${D}"/etc/rc.d || die
+       rm -rf "${D}"/etc/default || die
+
+       # and install gentoo style init script
+       newinitd "${FILESDIR}"/389-ds.initd 389-ds
+       newinitd "${FILESDIR}"/389-ds-snmp.initd 389-ds-snmp
+
+       # install Gentoo-specific start/stop scripts
+       rm -f "${D}"/usr/sbin/{re,}start-dirsrv || die "cannot remove 389 start/stop executables"
+       exeinto /usr/sbin
+       doexe "${FILESDIR}"/{re,}start-dirsrv
+
+       # cope with libraries being in /usr/lib/dirsrv
+       dodir /etc/env.d
+       echo "LDPATH=/usr/$(get_libdir)/dirsrv" > "${D}"/etc/env.d/08dirsrv
+
+       # create the directory where our log file and database
+       diropts -m 0750 -o dirsrv -g dirsrv
+       keepdir /var/lib/dirsrv
+       dodir /var/lock/dirsrv
+
+       # snmp agent, required directory
+       keepdir /var/agentx
+       dodir /var/agentx
+
+       if use doc; then
+               cd "${S}"
+               doxygen slapi.doxy || die "cannot run doxygen"
+               dohtml -r docs/html
+       fi
+}
+
+pkg_postinst() {
+       if use selinux; then
+               if has "loadpolicy" $FEATURES; then
+                       einfo "Inserting the following modules into the module store"
+                       cd /usr/share/selinux/targeted # struct policy not supported
+                       semodule -s dirsrv -i dirsrv.pp
+               else
+                       elog
+                       elog "Policy has not been loaded.  It is strongly suggested"
+                       elog "that the policy be loaded before continuing!!"
+                       elog
+                       elog "Automatic policy loading can be enabled by adding"
+                       elog "\"loadpolicy\" to the FEATURES in make.conf."
+                       elog
+                       ebeep 4
+               fi
+       fi
+
+       elog
+       elog "If you are planning to use 389-ds-snmp (ldap-agent),"
+       elog "make sure to properly configure: /etc/dirsrv/config/ldap-agent.conf"
+       elog "adding proper 'server' entries, and adding the lines below to"
+       elog " => /etc/snmp/snmpd.conf"
+       elog
+       elog "master agentx"
+       elog "agentXSocket /var/agentx/master"
+       elog
+       elog
+       elog "To start 389 Directory Server (LDAP service) at boot:"
+       elog
+       elog "    rc-update add 389-ds default"
+       elog
+}
diff --git a/net-nds/389-ds-base/ChangeLog b/net-nds/389-ds-base/ChangeLog
new file mode 100644 (file)
index 0000000..2871372
--- /dev/null
@@ -0,0 +1,15 @@
+# ChangeLog for net-nds/389-ds-base
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/389-ds-base/ChangeLog,v 1.1 2010/07/07 14:31:36 lxnay Exp $
+
+*389-ds-base-1.2.6_rc3 (07 Jul 2010)
+
+  07 Jul 2010; Fabio Erculiani <lxnay@gentoo.org>
+  +files/1.2.6/selinux_gentoo.patch, +files/1.2.6/selinux_makefile.patch,
+  +files/389-ds.initd, +files/389-ds-snmp.initd,
+  +389-ds-base-1.2.6_rc3.ebuild, +files/restart-dirsrv, +files/start-dirsrv,
+  +metadata.xml:
+  new ebuild, 389 Directory Server server package, thanks to
+  Andreis_Vinogradovs ( slepnoga ) <spamslepnoga@inbox.ru> for the base
+  ebuild, closing #309553
+
diff --git a/net-nds/389-ds-base/Manifest b/net-nds/389-ds-base/Manifest
new file mode 100644 (file)
index 0000000..55bd99a
--- /dev/null
@@ -0,0 +1,10 @@
+AUX 1.2.6/selinux_gentoo.patch 410 RMD160 28cf3a3ecf9de2216af7f8b6b1da5b8420e78c14 SHA1 3641911617b1ed7103d2ac6ee5373d6e96889f17 SHA256 bf5935e7a4330bb88bb57058f26e44db57fc967a86d6f562243ec987846b879c
+AUX 1.2.6/selinux_makefile.patch 448 RMD160 a51d3a8fc81e4580984dd6e8ec89dcf5f9a8f66d SHA1 96f71c778609dcb1b8cde91757f55d3766f9d3d7 SHA256 ee4251bd1753696df385175a457c90a6e06f88eea8465e98a681d85b10bb81bc
+AUX 389-ds-snmp.initd 1076 RMD160 7a3be7745e7e7a6de675b40b56556bfacef76a9a SHA1 8d8cbaa5c288d7d2a4ec25a2d85b406336c37073 SHA256 0dccceef42e29b5f696fc241cccdb3641eca3d8e300aef13b13ba1a40f8382e1
+AUX 389-ds.initd 1872 RMD160 807455864decce2bc832072d2d4daf034fe22e7a SHA1 ba6f806e23e3c71ad84241e4ef66af1e79241340 SHA256 018d392bcd8ba363ce2ee3b02c81a02b90fed10599d24dab5327d864518a79be
+AUX restart-dirsrv 577 RMD160 438df6a53eb0253a25371265ccb85662d0df408b SHA1 2ae8467499b821db040906fd80fe891a8ecefebe SHA256 40b4a28517a2c77ded2d71183a35e6bbf22eec24860282a08ef0033220bf9a98
+AUX start-dirsrv 294 RMD160 8b923441ef7c0f1458fb9fe8b122302593171dca SHA1 036dd12df0829c4cdd38091af7719eb1be72fbe5 SHA256 c7b63348db50bae6125561bc3379c2c9794a05b3486abeff9535c8aeca7146ee
+DIST 389-ds-base-1.2.6.rc3.tar.bz2 2867964 RMD160 9d69aa27c8cd762eb3f483e6b10faa8c70239ae7 SHA1 9a13db5b890514172a0283d4225eea62ef20c5e3 SHA256 4aff1db07b111a2e650b25e48835a927b2e46d78c233f06ea8854a35f4979330
+EBUILD 389-ds-base-1.2.6_rc3.ebuild 5204 RMD160 3f340066482050303f9960c3cdc13b63f3ec1b58 SHA1 4e4853b1186ffff5e77d483482c4c7fab43a38f2 SHA256 dd73c029c71b225cc2b95e7ca7cc01dc5b956e5cffe8fff262dba153f1b650c1
+MISC ChangeLog 675 RMD160 5df061dacbe4d895318c45fd3c6dd28b3a7efd4d SHA1 c47e5f55d92b8dc25660b6f9aa7d5f7d7271428b SHA256 be60d07c827551cff1cc66b59b46a1d99989a23feb848358463f2361ce8168a7
+MISC metadata.xml 1163 RMD160 a353cac97e2fd689390140c13f9f88f2f967997a SHA1 ce43e65ecbadfa4571912284a9a766801243cc46 SHA256 e15373c056d1d586ea5e80af27f49df1e05c5fb994cc43ef3b943fc733fb4dea
diff --git a/net-nds/389-ds-base/files/1.2.6/selinux_gentoo.patch b/net-nds/389-ds-base/files/1.2.6/selinux_gentoo.patch
new file mode 100644 (file)
index 0000000..4f6036f
--- /dev/null
@@ -0,0 +1,11 @@
+--- m4.orig/selinux.m4 2010-03-09 04:02:20.562880260 +0200
++++ m4/selinux.m4      2010-03-09 04:03:16.558882069 +0200
+@@ -27,7 +27,7 @@
+   with_selinux=yes
+   AC_MSG_RESULT(yes)
+   AC_SUBST(with_selinux)
+-  if test ! -f "/usr/share/selinux/devel/Makefile"; then
++  if test ! -f "/usr/share/selinux/targeted/include/Makefile"; then
+     AC_MSG_ERROR([SELinux development tools (selinux-policy) not found])
+   fi
+ ],
diff --git a/net-nds/389-ds-base/files/1.2.6/selinux_makefile.patch b/net-nds/389-ds-base/files/1.2.6/selinux_makefile.patch
new file mode 100644 (file)
index 0000000..3ad7bda
--- /dev/null
@@ -0,0 +1,10 @@
+--- selinux.orig/Makefile      2010-03-09 04:55:28.915799132 +0200
++++ selinux/Makefile   2010-03-09 04:57:09.214733326 +0200
+@@ -1,6 +1,5 @@
+-POLICY_MAKEFILE = /usr/share/selinux/devel/Makefile
+ POLICY_DIR = $(DESTDIR)/usr/share/selinux/targeted
+-
++POLICY_MAKEFILE = /usr/share/selinux/targeted/include/Makefile
+ all:
+       if [ ! -e $(POLICY_MAKEFILE) ]; then echo "You need to install the SELinux policy development tools (selinux-policy)" && exit 1; fi
+ 
diff --git a/net-nds/389-ds-base/files/389-ds-snmp.initd b/net-nds/389-ds-base/files/389-ds-snmp.initd
new file mode 100644 (file)
index 0000000..15ce834
--- /dev/null
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/389-ds-base/files/389-ds-snmp.initd,v 1.1 2010/07/07 14:31:36 lxnay Exp $
+
+PIDFILE="/var/run/ldap-agent.pid"
+CONFIGFILE="/etc/dirsrv/config/ldap-agent.conf"
+
+# instance support in progress
+
+depend() {
+       need net
+       use logger snmpd
+}
+
+start() {
+       ebegin "Starting 389 Directory Server ldap-snmp agent"
+       start-stop-daemon --start --quiet -b \
+               --pidfile ${PIDFILE} --exec /usr/sbin/ldap-agent -- ${CONFIGFILE}
+       eend ${?}
+       if [ "${?}" != "0" ]; then
+               local entries=/etc/dirsrv/slapd-*
+               if [ -n "${entries}" ]; then
+                       ewarn "Please make sure that ${CONFIGFILE} contains at least"
+                       ewarn "one of the following entries:"
+                       for entry in ${entries}; do
+                               entry=$(basename ${entry})
+                               ewarn "server ${entry}"
+                       done
+               fi
+       fi
+}
+
+stop() {
+       ebegin "Stopping 389 Directory Server ldap-snmp agent"
+       start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
+       eend ${?}
+       
+}
+
+restart() {
+       svc_stop
+       sleep 2
+       svc_start
+}
diff --git a/net-nds/389-ds-base/files/389-ds.initd b/net-nds/389-ds-base/files/389-ds.initd
new file mode 100644 (file)
index 0000000..6cb417e
--- /dev/null
@@ -0,0 +1,74 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-nds/389-ds-base/files/389-ds.initd,v 1.1 2010/07/07 14:31:36 lxnay Exp $
+
+DIRSRV_EXEC="/usr/sbin/ns-slapd"
+PID_DIRECTORY="/var/run/dirsrv"
+DIRSRV_CONF_DIR="/etc/dirsrv"
+DS_INSTANCES=${DIRSRV_CONF_DIR}/slapd-*
+F389DS_INSTANCES=""
+
+depend() {
+       need net
+       use dns
+       provide dirsvr ldap
+}
+
+checkconfig() {
+       if [ -z "${DS_INSTANCES}" ]; then
+               eerror "389 Directory Server has not been configured."
+               eend 1
+               return 1
+       fi
+}
+
+start() {
+       checkconfig || return 1
+
+       for instance in ${DS_INSTANCES}; do
+               instance=$(basename ${instance})
+               ebegin "Starting 389 Directory Server: instance ${instance}"
+               start-stop-daemon --start --quiet -m \
+                       --pidfile ${PID_DIRECTORY}/${instance}.startpid \
+                       --exec ${DIRSRV_EXEC} -- -D ${DIRSRV_CONF_DIR}/${instance} \
+                       -i ${PID_DIRECTORY}/${instance}.pid \
+                       -w ${PID_DIRECTORY}/${instance}.startpid
+               sts=${?}
+               eend ${?}
+               if [ "${sts}" != "0" ]; then
+                       return 1
+               fi
+       done
+}
+
+
+
+stop() {
+       checkconfig || return 1
+
+       for instance in ${DS_INSTANCES}; do
+               instance=$(basename ${instance})
+               ebegin "Stopping 389 Directory Server: instance ${instance}"
+               start-stop-daemon --stop --quiet \
+                       --pidfile ${PID_DIRECTORY}/${instance}.pid \
+                       --exec ${DIRSRV_EXEC}
+               eend ${?}
+       done
+}
+
+status() {
+       for instance in ${DS_INSTANCES}; do
+               instance=$(basename ${instance})
+               if [ -e ${PID_DIRECTORY}/${instance}.pid ]; then
+                       pid=$(cat ${PID_DIRECTORY}/${instance}.pid)
+                       if [ $(echo "$pid" | grep -c $pid) -ge 1 ]; then
+                               einfo "389 Directory Server: instance ${instance} (pid $pid) running."
+                       else
+                               ewarn "389 Directory Server: instance ${instance} (pid $pid) NOT running."
+                       fi
+               else
+                       eerror "389 Directory Server: instance ${instance} is NOT running."
+               fi
+       done
+}
diff --git a/net-nds/389-ds-base/files/restart-dirsrv b/net-nds/389-ds-base/files/restart-dirsrv
new file mode 100644 (file)
index 0000000..b4d5746
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Script that restarts the ns-slapd server.
+# Exit status can be:
+#       0: Server restarted successfully
+#       1: Server could not be started
+#       2: Server started successfully (was not running)
+#       3: Server could not be stopped
+
+sleep_time=8
+running=$(/etc/init.d/389-ds status &> /dev/null)
+
+rc-config stop 389-ds
+if [ "${?}" = "1" ]; then
+       sleep ${sleep_time}
+       exit 3
+fi
+rc-config start 389-ds
+if [ "${?}" = "1" ]; then
+       sleep ${sleep_time}
+       exit 1
+fi
+if [ "${running}" = "0" ]; then
+       sleep ${sleep_time}
+       exit 0
+else
+       sleep ${sleep_time}
+       exit 2
+fi
diff --git a/net-nds/389-ds-base/files/start-dirsrv b/net-nds/389-ds-base/files/start-dirsrv
new file mode 100644 (file)
index 0000000..7db799a
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Script that starts the ns-slapd server.
+# Exit status can be:
+#       0: Server started successfully
+#       1: Server could not be started
+#       2: Server already running
+
+rc-config stop 389-ds
+rc=$(rc-config start 389-ds)
+# give the daemon a chance to start
+sleep 8
+exit ${rc}
diff --git a/net-nds/389-ds-base/metadata.xml b/net-nds/389-ds-base/metadata.xml
new file mode 100644 (file)
index 0000000..2f0221c
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <herd>no-herd</herd>
+<maintainer>
+  <email>lxnay@gentoo.org</email>
+ <description>The enterprise-class Open Source LDAP server for Linux</description> 
+</maintainer>
+ <longdescription>The enterprise-class Open Source LDAP server for Linux</longdescription> 
+ <use>
+       <flag name='pam-passthru'>Enable pam-passthru plugin - for simple and fast system services used in ldap</flag>
+       
+       <flag name='dna'>Enable dna (distributed numeric assignment ) plugin -  to
+               automatically assign unique uid numbers to new user entries as they are created.</flag>
+       
+       <flag name='presence'>Enable presence plugin - non-stabdart syntax
+               validation</flag>
+       
+       <flag name='bitwise'>Enable bitwise plugin - supported data in raw/bitwise
+               format</flag>
+        <flag name='autobind'>Enable auto bind over unix domain socket (LDAPI)
+                support</flag>
+        <flag name='auto-dn-suffix'>Enable auto bind with auto dn suffix over unix
+        domain socket (LDAPI) support</flag>
+        <flag name='ldapi'>Enable LDAP over unix domain socket (LDAPI) support</flag>
+</use>
+</pkgmetadata>