From d8679f0250762892ab1e1a6d71badc2e9d42a526 Mon Sep 17 00:00:00 2001 From: Nicolás Reynolds Date: Sat, 12 Apr 2014 03:59:45 +0000 Subject: Sat Apr 12 03:57:05 UTC 2014 --- community/polipo/PKGBUILD | 27 +++++++++++++-------------- community/polipo/polipo.conf.d | 4 ---- community/polipo/polipo.install | 32 +++++++++++++++++++++++++++++--- community/polipo/polipo.service | 6 +++--- 4 files changed, 45 insertions(+), 24 deletions(-) delete mode 100644 community/polipo/polipo.conf.d (limited to 'community/polipo') diff --git a/community/polipo/PKGBUILD b/community/polipo/PKGBUILD index 144e4fe19..9b1ebc1d6 100644 --- a/community/polipo/PKGBUILD +++ b/community/polipo/PKGBUILD @@ -1,13 +1,14 @@ -# $Id: PKGBUILD 90446 2013-05-12 13:12:12Z jelle $ +# $Id: PKGBUILD 109185 2014-04-11 06:07:08Z thestinger $ # Maintainer: Thorsten Töpper # Contributor: Jelle van der Waa +# Contributor: Daniel Micay # Contributor: Thomas Holmquist # Contributor: Jan Boehringer # Contributor: Alex Griffin pkgname=polipo pkgver=1.0.4.1 -pkgrel=10 +pkgrel=12 pkgdesc="A small and fast caching web proxy." arch=('i686' 'x86_64') url="http://www.pps.jussieu.fr/~jch/software/polipo/" @@ -16,14 +17,12 @@ depends=('bash') makedepends=('texinfo') install=polipo.install source=("http://freehaven.net/~chrisd/polipo/polipo-$pkgver.tar.gz" - "polipo.conf.d" "polipo.service") + polipo.service) md5sums=('bfc5c85289519658280e093a270d6703' - '685aa0c6070dee11c701932d23afcc6a' - '143ef45db99dc745b6c3a606847be9fe') + '3861a067f6cdd2b8afcee1de97678902') build() { cd "$srcdir/$pkgname-$pkgver" - make } @@ -34,19 +33,19 @@ package() { INFODIR="$pkgdir/usr/share/info" \ LOCAL_ROOT="$pkgdir/usr/share/polipo/www" \ DISK_CACHE_ROOT="$pkgdir/var/cache/polipo" \ - install - + install # install config files - install -Dm 644 config.sample $pkgdir/etc/polipo/config.sample - install -Dm 644 forbidden.sample $pkgdir/etc/polipo/forbidden.sample + install -Dm 644 config.sample "$pkgdir/etc/polipo/config.sample" + install -Dm 644 forbidden.sample "$pkgdir/etc/polipo/forbidden.sample" # install license - install -Dm644 COPYING $pkgdir/usr/share/licenses/polipo/LICENSE + install -Dm644 COPYING "$pkgdir/usr/share/licenses/polipo/LICENSE" + + # install systemd service + install -Dm 644 "$srcdir/polipo.service" "$pkgdir/usr/lib/systemd/system/polipo.service" - # install systemd service / cron - install -Dm 644 $srcdir/polipo.service $pkgdir/usr/lib/systemd/system/polipo.service - install -Dm 644 $srcdir/polipo.conf.d $pkgdir/etc/conf.d/polipo.conf + install -dm 700 -o 185 -g 185 "$pkgdir/var/cache/polipo" } # vim:set ts=2 sw=2 et: diff --git a/community/polipo/polipo.conf.d b/community/polipo/polipo.conf.d deleted file mode 100644 index dc879d32b..000000000 --- a/community/polipo/polipo.conf.d +++ /dev/null @@ -1,4 +0,0 @@ -# -# Parameters to be passed to polipo -# -POLIPO_ARGS="daemonise=true logFile=\"/var/log/polipo.log\"" diff --git a/community/polipo/polipo.install b/community/polipo/polipo.install index bacc46377..03ed67ead 100644 --- a/community/polipo/polipo.install +++ b/community/polipo/polipo.install @@ -1,17 +1,37 @@ infodir=/usr/share/info filelist=(polipo.info) +create_polipo_user() { + getent group polipo &>/dev/null || groupadd -g 185 polipo >/dev/null + getent passwd polipo &>/dev/null || useradd -u 185 -g polipo \ + -d /var/cache/polipo \ + -c 'Caching web proxy' \ + -s /bin/nologin polipo >/dev/null +} + post_install() { [ -x usr/bin/install-info ] || return 0 for file in ${filelist[@]}; do install-info $infodir/$file $infodir/dir 2> /dev/null done - install -d /var/cache/polipo 2> /dev/null - touch /var/log/polipo.log 2> /dev/null - chown -R nobody:nobody /var/cache/polipo /var/log/polipo.log 2> /dev/null + create_polipo_user } post_upgrade() { + if [[ $(vercmp $2 1.0.4.1-11) -le 0 ]]; then + echo Stopping polipo service in order to modify the user/group. + systemctl stop polipo + + # in case the user/group were already created as recommended by the wiki + userdel polipo &>/dev/null + groupdel polipo &>/dev/null + + create_polipo_user + chown -R 185:185 /var/cache/polipo + + echo You may now restart the polipo service. + fi + post_install $1 } @@ -22,4 +42,10 @@ pre_remove() { done } +post_remove() { + getent passwd polipo &>/dev/null && userdel polipo >/dev/null + getent group polipo &>/dev/null && groupdel polipo >/dev/null + true +} + # vim:set ts=2 sw=2 et: diff --git a/community/polipo/polipo.service b/community/polipo/polipo.service index a4c0f6d94..185d6db36 100644 --- a/community/polipo/polipo.service +++ b/community/polipo/polipo.service @@ -3,9 +3,9 @@ Description=Polipo Proxy Server After=network.target [Service] -Type=forking -ExecStart=/usr/bin/polipo daemonise=true logFile="/var/log/polipo.log" -User=nobody +ExecStart=/usr/bin/polipo +User=polipo +PrivateDevices=yes [Install] WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf