From 4bc61018eec54dbe50e7556ce01d2ef2859b2c9f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Feb 2012 23:14:54 +0000 Subject: Thu Feb 9 23:14:54 UTC 2012 --- community-testing/privoxy/PKGBUILD | 64 +++++++++++++++++++++++++++ community-testing/privoxy/privoxy | 53 ++++++++++++++++++++++ community-testing/privoxy/privoxy.conf.d | 10 +++++ community-testing/privoxy/privoxy.install | 19 ++++++++ community-testing/privoxy/privoxy.logrotate.d | 8 ++++ 5 files changed, 154 insertions(+) create mode 100644 community-testing/privoxy/PKGBUILD create mode 100644 community-testing/privoxy/privoxy create mode 100644 community-testing/privoxy/privoxy.conf.d create mode 100644 community-testing/privoxy/privoxy.install create mode 100644 community-testing/privoxy/privoxy.logrotate.d (limited to 'community-testing/privoxy') diff --git a/community-testing/privoxy/PKGBUILD b/community-testing/privoxy/PKGBUILD new file mode 100644 index 000000000..dfd2469da --- /dev/null +++ b/community-testing/privoxy/PKGBUILD @@ -0,0 +1,64 @@ +# $Id: PKGBUILD 64099 2012-02-08 23:54:59Z allan $ +# Maintainer: Lukas Fleischer +# Contributor: Juergen Hoetzel +# Contributor: basilburn (basilburn), Paul Bredbury (brebs) + +pkgname=privoxy +pkgver=3.0.19 +pkgrel=2 +pkgdesc='A web proxy with advanced filtering capabilities.' +arch=('i686' 'x86_64') +url='http://www.privoxy.org' +license=('GPL') +depends=('pcre' 'zlib') +makedepends=('autoconf') +backup=('etc/conf.d/privoxy' + 'etc/privoxy/'{config,trust,default.action,user.filter,default.filter} + 'etc/privoxy/'{match-all,user}.action + 'etc/logrotate.d/privoxy') +install='privoxy.install' +source=("http://downloads.sourceforge.net/ijbswa/${pkgname}-${pkgver}-stable-src.tar.gz" + 'privoxy' + 'privoxy.logrotate.d' + 'privoxy.conf.d') +md5sums=('57acc79059565cc42eda67982842785d' + '1b4ed8c4e7e5b04b10ef41b597dc3f3b' + '79480f311313cc43974f6cbe6b672927' + '27830ef79418e277b90c1c1fa933f876') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}-stable" + + autoheader + autoconf + ./configure --prefix=/usr --sysconfdir=/etc/privoxy + + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}-stable" + + make prefix="${pkgdir}/usr" MAN_DEST="${pkgdir}/usr/share/man/man1" GROUP=42 \ + CONF_BASE="${pkgdir}/etc/privoxy" VAR_DEST="${pkgdir}/var" install + + # Don't overwrite existing log files! + rm "${pkgdir}/var/log/privoxy/"* + + install -Dm0755 "${srcdir}/privoxy" "${pkgdir}/etc/rc.d/privoxy" + install -Dm0644 "${srcdir}/privoxy.logrotate.d" "${pkgdir}/etc/logrotate.d/privoxy" + install -Dm0644 "${srcdir}/privoxy.conf.d" "${pkgdir}/etc/conf.d/privoxy" + + # Fix config paths. + sed -i -e 's#^confdir.*$#confdir /etc/privoxy#' -e 's#^logdir.*$#logdir /var/log/privoxy#' \ + -e '/^user-manual/s#.*#\#user-manual /usr/share/doc/privoxy/user-manual/#' \ + "${pkgdir}/etc/privoxy/config" + + # Fix group ownership and permissions. + chgrp -R 42 "${pkgdir}/etc/privoxy/" + chgrp -R 42 "${pkgdir}/var/log/privoxy/" + + find "${pkgdir}/etc/privoxy/" -type d | xargs chmod 0770 + find "${pkgdir}/etc/privoxy/" -type f | xargs chmod 0660 + chmod 0700 "${pkgdir}/var/log/privoxy" +} diff --git a/community-testing/privoxy/privoxy b/community-testing/privoxy/privoxy new file mode 100644 index 000000000..754453de5 --- /dev/null +++ b/community-testing/privoxy/privoxy @@ -0,0 +1,53 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +# source application-specific settings +[ -f /etc/conf.d/privoxy ] && . /etc/conf.d/privoxy + +# read logdir and logfile from privoxy config +prld=`grep ^logdir "$PRIVOXY_CONF" 2>/dev/null | cut -d' ' -f2` +[ -n "$prld" ] || prld=/var/log/privoxy +prlf=`grep ^logfile "$PRIVOXY_CONF" 2>/dev/null | cut -d' ' -f2` +[ -n "$prlf" ] || prlf=logfile + +PID=`pidof -o %PPID /usr/sbin/privoxy` + +case "$1" in + start) + stat_busy "Starting Privoxy" + # create missing logdir and logfile + [ -d "$prld" ] || mkdir -p "$prld" + if [ ! -f "$prlf" ]; then + touch "$prld/$prlf" && chgrp "${PRIVOXY_GROUP}" "$prld/$prlf" && \ + chmod 0660 "$prld/$prlf" + fi + [ -z "$PID" ] && /usr/sbin/privoxy --user ${PRIVOXY_USER}.${PRIVOXY_GROUP} \ + ${PRIVOXY_ARGS} ${PRIVOXY_CONF} + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon privoxy + stat_done + fi + ;; + stop) + stat_busy "Stopping Privoxy" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon privoxy + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/community-testing/privoxy/privoxy.conf.d b/community-testing/privoxy/privoxy.conf.d new file mode 100644 index 000000000..9aa11cd67 --- /dev/null +++ b/community-testing/privoxy/privoxy.conf.d @@ -0,0 +1,10 @@ +# Location of the config file. +PRIVOXY_CONF='/etc/privoxy/config' + +# User and group that privoxy will be run as. +PRIVOXY_USER='privoxy' +PRIVOXY_GROUP='privoxy' + +# Additional arguments. +PRIVOXY_ARGS="--pidfile /var/run/privoxy.pid" + diff --git a/community-testing/privoxy/privoxy.install b/community-testing/privoxy/privoxy.install new file mode 100644 index 000000000..c3ed75111 --- /dev/null +++ b/community-testing/privoxy/privoxy.install @@ -0,0 +1,19 @@ +post_install() { + groupadd -g 42 privoxy &>/dev/null + useradd -u 42 -g privoxy -d /var/spool/privoxy -s /bin/false privoxy &>/dev/null + chown -R privoxy:privoxy /etc/privoxy /var/log/privoxy + + if [ ! -d /var/spool/privoxy ]; then + install -dm0770 -o privoxy -g privoxy /var/spool/privoxy + fi +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + userdel privoxy &>/dev/null + groupdel privoxy &>/dev/null + rm -rf var/spool/privoxy +} diff --git a/community-testing/privoxy/privoxy.logrotate.d b/community-testing/privoxy/privoxy.logrotate.d new file mode 100644 index 000000000..386766c3e --- /dev/null +++ b/community-testing/privoxy/privoxy.logrotate.d @@ -0,0 +1,8 @@ +/var/log/privoxy/* { + create 660 root privoxy + notifempty + compress + postrotate + /bin/kill -HUP `cat /var/run/privoxy.pid 2>/dev/null` 2> /dev/null || true + endscript +} -- cgit v1.2.3-54-g00ecf