summaryrefslogtreecommitdiff
path: root/net-proxy/polipo/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-proxy/polipo/files
reinit the tree, so we can have metadata
Diffstat (limited to 'net-proxy/polipo/files')
-rw-r--r--net-proxy/polipo/files/config8
-rw-r--r--net-proxy/polipo/files/polipo.crond-222
-rw-r--r--net-proxy/polipo/files/polipo.initd-565
-rw-r--r--net-proxy/polipo/files/polipo_at.service11
4 files changed, 106 insertions, 0 deletions
diff --git a/net-proxy/polipo/files/config b/net-proxy/polipo/files/config
new file mode 100644
index 000000000000..4c9235582594
--- /dev/null
+++ b/net-proxy/polipo/files/config
@@ -0,0 +1,8 @@
+daemonise=false
+diskCacheRoot=/var/cache/polipo/
+proxyAddress=127.0.0.1
+proxyName=localhost
+serverSlots=4
+serverMaxSlots=8
+cacheIsShared=true
+allowedClients=127.0.0.1
diff --git a/net-proxy/polipo/files/polipo.crond-2 b/net-proxy/polipo/files/polipo.crond-2
new file mode 100644
index 000000000000..6b2d609d6d6a
--- /dev/null
+++ b/net-proxy/polipo/files/polipo.crond-2
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Loop through all init.d instances
+for f in /etc/init.d/polipo*; do
+ # only proceed if daemon is running
+ "${f}" --quiet status || continue
+
+ myname="${f#/etc/init.d/polipo}"
+ conffile="/etc/polipo/config${myname}"
+ pidfile="/var/run/polipo${myname}.pid"
+
+ # check if disk cache is enabled
+ polipo -v -c "${CONFFILE}" |
+ awk '$1 ~ /diskCacheRoot/ { if ($3 == "(none)") exit 1}' ||
+ continue
+
+ # Expire old cached objects
+ kill -USR1 $(cat "${pidfile}")
+ sleep 1
+ nice -n 15 su -s "/bin/sh" -c "polipo -c ${conffile} -x" polipo > /dev/null
+ kill -USR2 $(cat "${pidfile}")
+done
diff --git a/net-proxy/polipo/files/polipo.initd-5 b/net-proxy/polipo/files/polipo.initd-5
new file mode 100644
index 000000000000..08f3394eda68
--- /dev/null
+++ b/net-proxy/polipo/files/polipo.initd-5
@@ -0,0 +1,65 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+CONFFILE="/etc/polipo/config${SVCNAME#polipo}"
+PIDFILE="/var/run/${SVCNAME}.pid"
+
+depend() {
+ use 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/files/polipo_at.service b/net-proxy/polipo/files/polipo_at.service
new file mode 100644
index 000000000000..5018ac6c75e0
--- /dev/null
+++ b/net-proxy/polipo/files/polipo_at.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Polipo Proxy Server
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/polipo -c /etc/polipo/%i
+User=polipo
+PrivateDevices=yes
+
+[Install]
+WantedBy=multi-user.target