commit:     ef7f42bb90ae70f2c4ca34ba737640434af2c4c2
Author:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 12:11:10 2016 +0000
Commit:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
CommitDate: Fri Apr 22 12:11:39 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef7f42bb

net-proxy/polipo: honor multiple instances at init script

Use ${SVCNAME} for ebegin/eend messages.

Package-Manager: portage-2.2.28
Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>

 net-proxy/polipo/files/polipo.initd-4              | 66 ++++++++++++++++++++++
 .../{polipo-9999.ebuild => polipo-1.1.1-r3.ebuild} |  4 +-
 net-proxy/polipo/polipo-9999.ebuild                |  4 +-
 3 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/net-proxy/polipo/files/polipo.initd-4 
b/net-proxy/polipo/files/polipo.initd-4
new file mode 100644
index 0000000..705185e
--- /dev/null
+++ b/net-proxy/polipo/files/polipo.initd-4
@@ -0,0 +1,66 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+CONFFILE="/etc/polipo/config${SVCNAME#polipo}"
+PIDFILE="/var/run/${SVCNAME}.pid"
+
+depend() {
+       need net
+}
+
+checkconfig() {
+       { polipo -v -c "${CONFFILE}" || return 1 ; } | {
+               local retvalue=0
+               local name type value desc
+               while read name type value desc ; do
+                       case ${name} in
+                       configFile)
+                               if [ "${value}" = "(none)" ] ; then
+                                       eerror "Unable to read configuration 
file /etc/polipo/config"
+                                       retvalue=1
+                               fi
+                               ;;
+                       daemonise)
+                               if [ "${value}" != "false" ] ; then
+                                       eerror "Configuration option not 
supported by this init script: ${name}=${value}"
+                                       retvalue=1
+                               fi
+                               ;;
+                       pidFile)
+                               if [ "${value}" != "(none)" ] ; then
+                                       eerror "Configuration option not 
supported by this init script: ${name}=${value}"
+                                       retvalue=1
+                               fi
+                               ;;
+                       diskCacheRoot)
+                               if [ "${value}" != "(none)" ] ; then
+                                       # Ensure that cache directory exists 
and have proper permissions
+                                       if ! [ -d "{value}" ]; then
+                                               mkdir -p -m 0750 "${value}"
+                                               chown polipo:polipo "${value}"
+                                       fi
+                               fi
+                               ;;
+                       esac
+               done
+               return ${retvalue}
+       }
+}
+
+start() {
+       checkconfig || return 1
+
+       ebegin "Starting ${SVCNAME} HTTP proxy"
+       start-stop-daemon --start --user polipo \
+               --background --pidfile "${PIDFILE}" --make-pidfile \
+               --exec /usr/bin/polipo -- -c "${CONFFILE}"
+       eend $?
+}
+
+stop() {
+       ebegin "Stopping ${SVCNAME} HTTP proxy"
+       start-stop-daemon --stop --pidfile "${PIDFILE}"
+       eend $?
+}

diff --git a/net-proxy/polipo/polipo-9999.ebuild 
b/net-proxy/polipo/polipo-1.1.1-r3.ebuild
similarity index 94%
copy from net-proxy/polipo/polipo-9999.ebuild
copy to net-proxy/polipo/polipo-1.1.1-r3.ebuild
index 8882b5d..559a3ed 100644
--- a/net-proxy/polipo/polipo-9999.ebuild
+++ b/net-proxy/polipo/polipo-1.1.1-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -38,7 +38,7 @@ src_compile() {
 src_install() {
        einstall PREFIX=/usr MANDIR=/usr/share/man INFODIR=/usr/share/info 
"TARGET=${D}"
 
-       newinitd "${FILESDIR}/${PN}.initd-2" ${PN}
+       newinitd "${FILESDIR}/${PN}.initd-4" ${PN}
        insinto /etc/${PN} ; doins "${FILESDIR}/config"
        systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
        if ! use systemd; then

diff --git a/net-proxy/polipo/polipo-9999.ebuild 
b/net-proxy/polipo/polipo-9999.ebuild
index 8882b5d..559a3ed 100644
--- a/net-proxy/polipo/polipo-9999.ebuild
+++ b/net-proxy/polipo/polipo-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -38,7 +38,7 @@ src_compile() {
 src_install() {
        einstall PREFIX=/usr MANDIR=/usr/share/man INFODIR=/usr/share/info 
"TARGET=${D}"
 
-       newinitd "${FILESDIR}/${PN}.initd-2" ${PN}
+       newinitd "${FILESDIR}/${PN}.initd-4" ${PN}
        insinto /etc/${PN} ; doins "${FILESDIR}/config"
        systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service"
        if ! use systemd; then

Reply via email to