From 703a3dceed15cbe4430cd07bcc0e7aa76827c357 Mon Sep 17 00:00:00 2001 From: Alin Năstac Date: Sat, 5 Dec 2009 06:49:37 +0000 Subject: Improve init script (#291651). (Portage version: 2.1.6.13/cvs/Linux x86_64, RepoMan options: --force) --- mail-filter/sid-milter/ChangeLog | 8 ++- mail-filter/sid-milter/files/sid-filter.conf | 4 +- mail-filter/sid-milter/files/sid-filter.init | 48 +++++++++++++++-- mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild | 66 ----------------------- mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild | 66 +++++++++++++++++++++++ 5 files changed, 119 insertions(+), 73 deletions(-) delete mode 100644 mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild create mode 100644 mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild 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 -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-r3.ebuild deleted file mode 100644 index 46ee3a9cd4f0..000000000000 --- a/mail-filter/sid-milter/sid-milter-1.0.0-r3.ebuild +++ /dev/null @@ -1,66 +0,0 @@ -# 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 $ - -EAPI="2" - -inherit eutils toolchain-funcs - -DESCRIPTION="A milter-based application to provide Sender-ID verification service" -HOMEPAGE="http://sourceforge.net/projects/sid-milter/" -SRC_URI="mirror://sourceforge/sid-milter/${P}.tar.gz" - -LICENSE="Sendmail-Open-Source" -SLOT="0" -KEYWORDS="~amd64 x86" -IUSE="ipv6" - -DEPEND="dev-libs/openssl - >=sys-libs/db-3.2 - || ( mail-filter/libmilter mail-mta/sendmail )" -RDEPEND="${DEPEND}" - -pkg_setup() { - enewgroup milter - # mail-milter/spamass-milter creates milter user with this home directory - # For consistency reasons, milter user must be created here with this home directory - # even though this package doesn't need a home directory for this user (#280571) - enewuser milter -1 -1 /var/lib/milter milter -} - -src_prepare() { - epatch "${FILESDIR}"/${P}-nopra_on_spf1.patch - epatch "${FILESDIR}"/${P}-as-needed.patch - - local CC="$(tc-getCC)" - local ENVDEF="" - use ipv6 && ENVDEF="${ENVDEF} -DNETINET6" - sed -e "s:@@CC@@:${CC}:" \ - -e "s:@@CFLAGS@@:${CFLAGS}:" \ - -e "s:@@LDFLAGS@@:${LDFLAGS}:" \ - -e "s:@@ENVDEF@@:${ENVDEF}:" \ - "${FILESDIR}/gentoo-config.m4" > "${S}/devtools/Site/site.config.m4" \ - || die "failed to generate site.config.m4" -} - -src_compile() { - emake -j1 || die "emake failed" -} - -src_install() { - dodir /usr/bin - emake -j1 DESTDIR="${D}" SUBDIRS=sid-filter \ - SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \ - install || die "make install failed" - - newinitd "${FILESDIR}/sid-filter.init" sid-filter \ - || die "newinitd failed" - newconfd "${FILESDIR}/sid-filter.conf" sid-filter \ - || die "newconfd failed" - - # man build is broken; do man page installation by hand - doman */*.8 || die "failed to install man pages" - - # some people like docs - dodoc RELEASE_NOTES *.txt sid-filter/README || die "failed to install docs" -} diff --git a/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild b/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild new file mode 100644 index 000000000000..6bf92345cdc8 --- /dev/null +++ b/mail-filter/sid-milter/sid-milter-1.0.0-r4.ebuild @@ -0,0 +1,66 @@ +# 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-r4.ebuild,v 1.1 2009/12/05 06:49:37 mrness Exp $ + +EAPI="2" + +inherit eutils toolchain-funcs + +DESCRIPTION="A milter-based application to provide Sender-ID verification service" +HOMEPAGE="http://sourceforge.net/projects/sid-milter/" +SRC_URI="mirror://sourceforge/sid-milter/${P}.tar.gz" + +LICENSE="Sendmail-Open-Source" +SLOT="0" +KEYWORDS="~amd64 x86" +IUSE="ipv6" + +DEPEND="dev-libs/openssl + >=sys-libs/db-3.2 + || ( mail-filter/libmilter mail-mta/sendmail )" +RDEPEND="${DEPEND}" + +pkg_setup() { + enewgroup milter + # mail-milter/spamass-milter creates milter user with this home directory + # For consistency reasons, milter user must be created here with this home directory + # even though this package doesn't need a home directory for this user (#280571) + enewuser milter -1 -1 /var/lib/milter milter +} + +src_prepare() { + epatch "${FILESDIR}"/${P}-nopra_on_spf1.patch + epatch "${FILESDIR}"/${P}-as-needed.patch + + local CC="$(tc-getCC)" + local ENVDEF="" + use ipv6 && ENVDEF="${ENVDEF} -DNETINET6" + sed -e "s:@@CC@@:${CC}:" \ + -e "s:@@CFLAGS@@:${CFLAGS}:" \ + -e "s:@@LDFLAGS@@:${LDFLAGS}:" \ + -e "s:@@ENVDEF@@:${ENVDEF}:" \ + "${FILESDIR}/gentoo-config.m4" > "${S}/devtools/Site/site.config.m4" \ + || die "failed to generate site.config.m4" +} + +src_compile() { + emake -j1 || die "emake failed" +} + +src_install() { + dodir /usr/bin + emake -j1 DESTDIR="${D}" SUBDIRS=sid-filter \ + SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \ + install || die "make install failed" + + newinitd "${FILESDIR}/sid-filter.init" sid-filter \ + || die "newinitd failed" + newconfd "${FILESDIR}/sid-filter.conf" sid-filter \ + || die "newconfd failed" + + # man build is broken; do man page installation by hand + doman */*.8 || die "failed to install man pages" + + # some people like docs + dodoc RELEASE_NOTES *.txt sid-filter/README || die "failed to install docs" +} -- cgit v1.2.3-65-gdbad