From 415856bdd4f48ab4f2732996f0bae58595092bbe Mon Sep 17 00:00:00 2001 From: Parabola Date: Tue, 5 Apr 2011 14:26:38 +0000 Subject: Tue Apr 5 14:26:38 UTC 2011 --- community/courier-authlib/PKGBUILD | 62 +++++++++++++++++++++++ community/courier-authlib/authdaemond.rc.d | 48 ++++++++++++++++++ community/courier-authlib/courier-authlib.install | 32 ++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 community/courier-authlib/PKGBUILD create mode 100644 community/courier-authlib/authdaemond.rc.d create mode 100644 community/courier-authlib/courier-authlib.install (limited to 'community/courier-authlib') diff --git a/community/courier-authlib/PKGBUILD b/community/courier-authlib/PKGBUILD new file mode 100644 index 000000000..5f8ec29e8 --- /dev/null +++ b/community/courier-authlib/PKGBUILD @@ -0,0 +1,62 @@ +# $Id: PKGBUILD 53167 2009-09-26 09:48:47Z allan $ +# Maintainer: Sven-Hendrik Haase +# Contributor: tobias +# Contributor: Tobias Kieslich + +pkgname=courier-authlib +pkgver=0.63.0 +pkgrel=4 +pkgdesc="Authentification library for the courier mailserver(s)" +arch=(i686 x86_64) +license=('GPL2') +url="http://courier-mta.org/authlib/" +backup=('etc/authlib/authdaemonrc' 'etc/authlib/authldaprc' \ + 'etc/authlib/authmysqlrc' 'etc/authlib/authpgsqlrc') +depends=('openssl' 'gdbm' 'perl' 'libtool' 'expect') +makedepends=('pam' 'expect' 'libldap' 'libmysqlclient' 'postgresql-libs>=8.3.0') +optdepends=('libmysqlclient' 'libldap' 'postgresql-libs') +conflicts=('courier-imap-mysql' 'courier-imap-pgsql' 'courier-imap-ldap') +provides=('courier-imap-mysql' 'courier-imap-pgsql' 'courier-imap-ldap') +install=${pkgname}.install +source=(http://downloads.sourceforge.net/project/courier/authlib/${pkgver}/${pkgname}-${pkgver}.tar.bz2 + authdaemond.rc.d) +md5sums=('411a927d178f783a1e8fab9964ce0dd2' + '911ee9f40d70fafc6bb4cc636c5ad531') + +build() { + #export MAKEFLAGS="-j1" + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + --with-db=gdbm \ + --with-mailuser=courier --with-mailgroup=courier \ + --with-authpam --with-authpwd --with-authshadow \ + --with-authldap --with-authmysql --with-authpgsql \ + --with-authuserdb --with-authcram --with-authdaemon + make +} + +package() { + cd ${srcdir}/${pkgname}-${pkgver} + make DESTDIR=${pkgdir} install + ############################################################################### + # post_installation ---- rename the config file and change ownerschip + for distfile in ${pkgdir}/etc/authlib/*.dist; do + chown 72:72 ${distfile} + mv ${distfile} ${pkgdir}/etc/authlib/`basename ${distfile} .dist` + done + # copy the .schema; mostly refered to as courier.schema -> rename it + install -Dm 444 authldap.schema \ + ${pkgdir}/etc/openldap/schema/courier.schema + ############################################################################### + # Install daemon, that wraps couriers bashscript + install -Dm 755 ${srcdir}/authdaemond.rc.d ${pkgdir}/etc/rc.d/authdaemond + chown -R 72:72 ${pkgdir}/var/spool/authdaemon + mkdir ${pkgdir}/var/spool/courier + chown -R 72:72 ${pkgdir}/var/spool/courier + # docs say we can remove .a files after make + find ${pkgdir} -name '*\.a' -exec rm -f {} \; +} diff --git a/community/courier-authlib/authdaemond.rc.d b/community/courier-authlib/authdaemond.rc.d new file mode 100644 index 000000000..ff4abb182 --- /dev/null +++ b/community/courier-authlib/authdaemond.rc.d @@ -0,0 +1,48 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +start() { + stat_busy "Starting Authdaemond" + /usr/sbin/authdaemond start &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + ln -s /var/spool/authdaemon/pid /var/run/authdaemond.pid + add_daemon authdaemond + stat_done + fi +} + +stop() { + stat_busy "Stopping Authdaemond" + /usr/sbin/authdaemond stop &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm -f /var/run/authdaemond.pid + rm_daemon authdaemond + # housecleaning; just like kids'n toys - don't care when it's needed anymore + rm -f /var/spool/authdaemon/{pid.lock,pid,socket} &> /dev/null + stat_done + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + # calling 'stop' and 'start' without the $0 fails... + $0 stop + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/community/courier-authlib/courier-authlib.install b/community/courier-authlib/courier-authlib.install new file mode 100644 index 000000000..cbccc636b --- /dev/null +++ b/community/courier-authlib/courier-authlib.install @@ -0,0 +1,32 @@ +# arg 1: the new package version +post_install() { + # creates group and user on virgin systems + if [ -z "`grep '^courier::' /etc/group`" ]; then + groupadd -g 72 courier >& /dev/null + fi + if [ -z "`grep '^courier:' /etc/passwd`" ]; then + useradd -u 72 -d /var/spool/courier -g courier -s /bin/false courier &>/dev/null + fi +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} + +# arg 1: the old package version +pre_remove() { + userdel courier &> /dev/null + groupdel courier &> /dev/null +} + + +post_remove() { + /bin/true +} + +op=$1 +shift + +$op $* -- cgit v1.2.3-54-g00ecf