Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=7cb7f86e9407fac0cfc1a2cb39c18b7929bd47e6

commit 7cb7f86e9407fac0cfc1a2cb39c18b7929bd47e6
Author: James Buren <[email protected]>
Date:   Mon Jul 30 02:11:09 2012 -0500

dovecot-2.1.8-1-x86_64
* version bump
* convert to systemd schema
* backup all config files
* add users required by default config

diff --git a/source/network-extra/dovecot/FrugalBuild 
b/source/network-extra/dovecot/FrugalBuild
index b63706a..d10d217 100644
--- a/source/network-extra/dovecot/FrugalBuild
+++ b/source/network-extra/dovecot/FrugalBuild
@@ -2,7 +2,7 @@
# Maintainer: Krisztian VASAS <[email protected]>

pkgname=dovecot
-pkgver=2.1.4
+pkgver=2.1.8
pkgrel=1
mainver=${pkgver%.*}
pkgdesc="An open source IMAP and POP3 server, written with security primarily 
in mind."
@@ -12,11 +12,15 @@ makedepends=('mysql>=5.5.10' 'postgresql')
groups=('network-extra')
archs=('i686' 'x86_64')
up2date="lynx -dump ${url}/download.html | grep -A2 'Stable ' | grep 'sources' 
| sed 's/.*Download\ .*v\(.*\)\ source.*/\1/'"
+backup=(etc/$pkgname/$pkgname.conf 
etc/$pkgname/conf.d/{20-lmtp.conf,15-lda.conf,20-imap.conf,15-mailboxes.conf,10-master.conf,10-auth.conf,90-quota.conf,10-ssl.conf,90-acl.conf,20-pop3.conf,10-mail.conf,90-plugin.conf,10-logging.conf,10-director.conf})
source=("${url}/releases/${mainver}/${pkgname}-${pkgver}.tar.gz" \
"rc.$pkgname" \
"rc.$pkgname-hu.po" )
signatures=("${source[0]}.sig" '' '')
-install="$pkgname.install"
+_F_systemd_scriptlet="$pkgname.install"
+_F_sysvinit_units=(dovecot)
+_F_systemd_units=(dovecot=)
+Finclude systemd

build()
{
@@ -29,11 +33,13 @@ build()
--with-deliver \
--with-iopoll=epoll \
--with-moduledir=/usr/lib/dovecot/modules \
-               --sysconfdir=/etc/dovecot \
+               --sysconfdir=/etc \
+               --with-systemdsystemunitdir=/lib/systemd/system \
--docdir=/usr/share/doc/dovecot-${pkgver}
Frcd2
-       Frm /etc/$pkgname/$pkgname
+       Frm /etc/$pkgname
Fcprel $Fdestdir/usr/share/doc/$pkgname-$pkgver/example-config/. etc/$pkgname/
+       Fgenscriptlet
}

# optimization OK
diff --git a/source/network-extra/dovecot/dovecot.install 
b/source/network-extra/dovecot/dovecot.install
index d764037..445c776 100644
--- a/source/network-extra/dovecot/dovecot.install
+++ b/source/network-extra/dovecot/dovecot.install
@@ -1,29 +1,71 @@
+sysvinit_units=(@_F_sysvinit_units@)
+systemd_units=(@_F_systemd_units@)
+
post_install()
{
-       mkdir -p /var/run/dovecot/login
-       chmod 750 /var/run/dovecot/login
-       chmod 700 /var/run/dovecot
-}
+       getent group dovecot >/dev/null || /usr/sbin/groupadd -g 70 dovecot
+       getent passwd dovecot >/dev/null || /usr/sbin/useradd -u 70 -g 70 
dovecot -s /sbin/nologin
+       getent group dovenull >/dev/null || /usr/sbin/groupadd -g 71 dovenull
+       getent passwd dovenull >/dev/null || /usr/sbin/useradd -u 71 -g 71 
dovenull -s /sbin/nologin

-pre_upgrade()
-{
-       /sbin/service dovecot 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
+       getent group dovecot >/dev/null || /usr/sbin/groupadd -g 70 dovecot
+       getent passwd dovecot >/dev/null || /usr/sbin/useradd -u 70 -g 70 
dovecot -s /sbin/nologin
+       getent group dovenull >/dev/null || /usr/sbin/groupadd -g 71 dovenull
+       getent passwd dovenull >/dev/null || /usr/sbin/useradd -u 71 -g 71 
dovenull -s /sbin/nologin
+
+       for i in ${sysvinit_units[@]}; do
+               chkconfig --del rc.$i >/dev/null 2>&1
+       done
+
+       systemctl daemon-reload >/dev/null 2>&1
}

pre_remove()
{
-       /sbin/service dovecot stop
-       /usr/sbin/chkconfig --del rc.dovecot
+       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()
+{
+       userdel dovecot
+       userdel dovenull
+       groupdel dovecot
+       groupdel dovenull
+
+       systemctl daemon-reload >/dev/null 2>&1
}

op=$1
shift
-
$op $*
-
-# vim: ft=sh
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to