summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlin Năstac <mrness@gentoo.org>2009-12-05 06:49:37 +0000
committerAlin Năstac <mrness@gentoo.org>2009-12-05 06:49:37 +0000
commit703a3dceed15cbe4430cd07bcc0e7aa76827c357 (patch)
tree3113959a5abc7ffb6aa71bd888455ebe62c87d52
parentAutomated update of use.local.desc (diff)
downloadgentoo-2-703a3dceed15cbe4430cd07bcc0e7aa76827c357.tar.gz
gentoo-2-703a3dceed15cbe4430cd07bcc0e7aa76827c357.tar.bz2
gentoo-2-703a3dceed15cbe4430cd07bcc0e7aa76827c357.zip
Improve init script (#291651).
(Portage version: 2.1.6.13/cvs/Linux x86_64, RepoMan options: --force)
-rw-r--r--mail-filter/sid-milter/ChangeLog8
-rw-r--r--mail-filter/sid-milter/files/sid-filter.conf4
-rwxr-xr-xmail-filter/sid-milter/files/sid-filter.init48
-rw-r--r--mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild (renamed from mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild)2
4 files changed, 54 insertions, 8 deletions
diff --git a/mail-filter/sid-milter/ChangeLog b/mail-filter/sid-milter/ChangeLog
index 09742f1ceeec..491d98204ce7 100644
--- a/mail-filter/sid-milter/ChangeLog
+++ b/mail-filter/sid-milter/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for mail-filter/sid-milter
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/ChangeLog,v 1.14 2009/08/22 23:20:57 mrness Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/ChangeLog,v 1.15 2009/12/05 06:49:37 mrness Exp $
+
+*sid-milter-1.0.0-r4 (05 Dec 2009)
+
+ 05 Dec 2009; Alin Năstac <mrness@gentoo.org> -sid-milter-1.0.0-r3.ebuild,
+ +sid-milter-1.0.0-r4.ebuild, files/sid-filter.conf, files/sid-filter.init:
+ Improve init script (#291651).
*sid-milter-1.0.0-r3 (22 Aug 2009)
diff --git a/mail-filter/sid-milter/files/sid-filter.conf b/mail-filter/sid-milter/files/sid-filter.conf
index 106a01d9ad02..fb506c393889 100644
--- a/mail-filter/sid-milter/files/sid-filter.conf
+++ b/mail-filter/sid-milter/files/sid-filter.conf
@@ -1,7 +1,5 @@
# Additional options for the Sender-ID Milter
# see sid-filter(8) for more information.
-SID_FILTER_OPTS=""
SOCKETSPEC="inet:8026@localhost"
DOMAIN="example.com"
-USER="milter"
-SID_FILTER_OPTS="-u milter -l -p $SOCKETSPEC -d $DOMAIN"
+SID_FILTER_OPTS="-u milter -l -p $SOCKETSPEC -d $DOMAIN -P /var/run/sid-filter.pid"
diff --git a/mail-filter/sid-milter/files/sid-filter.init b/mail-filter/sid-milter/files/sid-filter.init
index aaa2b4f9632e..1fdc734fda73 100755
--- a/mail-filter/sid-milter/files/sid-filter.init
+++ b/mail-filter/sid-milter/files/sid-filter.init
@@ -1,22 +1,64 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/files/sid-filter.init,v 1.1 2006/07/18 01:06:48 langthang Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/files/sid-filter.init,v 1.2 2009/12/05 06:49:37 mrness Exp $
depend() {
# need net
use dns logger net
}
+parse_opts() {
+ local filter_opt filter_flag=
+ for filter_opt in ${SID_FILTER_OPTS}; do
+ case "${filter_flag}" in
+ -u) filter_user=${filter_opt}
+ ;;
+ -P) filter_pid=${filter_opt}
+ ;;
+ esac
+ [ -n "${filter_user}" -a -n "${filter_pid}" ] && break
+ filter_flag=${filter_opt}
+ done
+
+ if [ -z "${filter_user}" ]; then
+ filter_user=milter
+ SID_FILTER_OPTS="${SID_FILTER_OPTS} -u ${filter_user}"
+ fi
+}
+
start() {
+ local filter_user= filter_pid= SSD_OPTS=
+
+ parse_opts
+ if [ -n "${filter_pid}" ]; then
+ if ! (touch ${filter_pid} && chown ${filter_user} ${filter_pid}) ; then
+ eerror "Failed to create pidfile"
+ return 1
+ fi
+ SSD_OPTS="--pidfile ${filter_pid}"
+ fi
+
ebegin "Starting Sender-ID Filter"
- start-stop-daemon --start --quiet --background \
+ start-stop-daemon --start --quiet --background ${SSD_OPTS} \
--exec /usr/bin/sid-filter -- ${SID_FILTER_OPTS}
eend $?
}
stop() {
+ local filter_user= filter_pid= SSD_OPTS=
+
+ parse_opts
+ if [ -n "${filter_pid}" ]; then
+ SSD_OPTS="--pidfile ${filter_pid}"
+ fi
+
ebegin "Stopping Sender-ID Filter"
- start-stop-daemon --stop --quiet --name sid-filter
+ start-stop-daemon --stop --quiet --name sid-filter ${SSD_OPTS}
eend $?
+
+ if [ $? = 0 -a -n "${filter_pid}" -a -f "${filter_pid}" ]; then
+ rm ${filter_pid}
+ fi
}
+
diff --git a/mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild b/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild
index 46ee3a9cd4f0..6bf92345cdc8 100644
--- a/mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild
+++ b/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild,v 1.1 2009/08/22 23:20:57 mrness Exp $
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild,v 1.1 2009/12/05 06:49:37 mrness Exp $
EAPI="2"