diff options
author | root <root@rshg054.dnsready.net> | 2012-06-24 00:04:12 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-06-24 00:04:12 +0000 |
commit | 4319f36e44d4e7c70bf010c3286bb1739c59d4de (patch) | |
tree | 570e5a756192067d69cbabeab8fcf6b81cec3c51 /community/polipo | |
parent | 11357a5ab02a7d536375fb8333b2fb67278b4a36 (diff) |
Sun Jun 24 00:04:11 UTC 2012
Diffstat (limited to 'community/polipo')
-rw-r--r-- | community/polipo/PKGBUILD | 16 | ||||
-rw-r--r-- | community/polipo/polipo.conf.d | 4 | ||||
-rw-r--r-- | community/polipo/polipo.install | 6 | ||||
-rw-r--r-- | community/polipo/polipo.rc.d | 121 | ||||
-rw-r--r-- | community/polipo/polipo.service | 10 |
5 files changed, 92 insertions, 65 deletions
diff --git a/community/polipo/PKGBUILD b/community/polipo/PKGBUILD index 5eaf8a991..e8749a5a4 100644 --- a/community/polipo/PKGBUILD +++ b/community/polipo/PKGBUILD @@ -1,4 +1,4 @@ -# $Id: PKGBUILD 65625 2012-02-21 12:15:55Z ttopper $ +# $Id: PKGBUILD 72794 2012-06-22 12:51:45Z dreisner $ # Maintainer: Thorsten Töpper <atsutane-tu@freethoughts.de> # Contributor: Jelle van der Waa <jelle vdwaa nl> # Contributor: Thomas Holmquist <thomas@vorget.com> @@ -7,20 +7,21 @@ pkgname=polipo pkgver=1.0.4.1 -pkgrel=2 +pkgrel=3 pkgdesc="A small and fast caching web proxy." arch=('i686' 'x86_64') url="http://www.pps.jussieu.fr/~jch/software/polipo/" license=('GPL') depends=('bash') -makedepends=(texinfo) +makedepends=('texinfo') install=polipo.install -source=(http://freehaven.net/~chrisd/polipo/polipo-$pkgver.tar.gz - polipo.cron polipo.rc.d) +source=("http://freehaven.net/~chrisd/polipo/polipo-$pkgver.tar.gz" + "polipo.cron" "polipo.rc.d" "polipo.conf.d" "polipo.service") md5sums=('bfc5c85289519658280e093a270d6703' 'bac0e1a871964c931eb5f7a369b3243c' - '443e442f7071e31dbd53fc9d810a2c3e') -conflicts=('polipo-git' 'polipo-darcs') + '8f096b7d77a71e0772ce71a8c8b1b3e3' + '685aa0c6070dee11c701932d23afcc6a' + '109d0e8c15d669281ff14f8991ad0ed8') build() { cd "$srcdir/$pkgname-$pkgver" @@ -48,6 +49,7 @@ package() { # install daemon scripts / cron install -Dm 755 $srcdir/polipo.rc.d $pkgdir/etc/rc.d/polipo install -Dm 755 $srcdir/polipo.cron $pkgdir/usr/share/polipo/polipo.cron + install -Dm 644 $srcdir/polipo.service $pkgdir/usr/lib/systemd/system/polipo.service } # vim:set ts=2 sw=2 et: diff --git a/community/polipo/polipo.conf.d b/community/polipo/polipo.conf.d new file mode 100644 index 000000000..dc879d32b --- /dev/null +++ b/community/polipo/polipo.conf.d @@ -0,0 +1,4 @@ +# +# 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 c3a4f82b9..bacc46377 100644 --- a/community/polipo/polipo.install +++ b/community/polipo/polipo.install @@ -6,9 +6,9 @@ post_install() { for file in ${filelist[@]}; do install-info $infodir/$file $infodir/dir 2> /dev/null done - - echo "You should create a config-file now, an example is located in /etc/polipo/." - echo "If you don't create a config-file, polipo will use its defaults." + 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 } post_upgrade() { diff --git a/community/polipo/polipo.rc.d b/community/polipo/polipo.rc.d index f9bbd4783..260fab050 100644 --- a/community/polipo/polipo.rc.d +++ b/community/polipo/polipo.rc.d @@ -1,60 +1,71 @@ #!/bin/bash + +daemon_name=polipo + . /etc/rc.conf . /etc/rc.d/functions +. /etc/conf.d/$daemon_name.conf + +get_pid() { + pidof -o %PPID $daemon_name +} + +case "$1" in + start) + stat_busy "Starting $daemon_name daemon" + + PID=$(get_pid) + if [[ -z $PID ]]; then + [[ -f /run/$daemon_name.pid ]] && + rm -f /run/$daemon_name.pid + # RUN + sudo -u nobody /usr/bin/$daemon_name ${POLIPO_ARGS} + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + echo $(get_pid) > /run/$daemon_name.pid + add_daemon $daemon_name + stat_done + fi + else + stat_fail + exit 1 + fi + ;; -DAEMON=polipo -ARGS="daemonise=true pidFile=/var/run/$DAEMON/$DAEMON.pid" -PID=$(pidof -o %PPID /usr/bin/$DAEMON) - -case $1 in - start) - stat_busy "Starting $DAEMON" - if ck_daemon $DAEMON; then - [[ ! -d /var/run/$DAEMON ]] && install -d $DAEMON /var/run/$DAEMON - /usr/bin/$DAEMON $ARGS >/dev/null 2>&1 - if [[ $? != 0 ]]; then - stat_fail - else - add_daemon polipo - stat_done - fi - else - stat_fail - fi - ;; - stop) - stat_busy "Stopping $DAEMON" - if ! ck_daemon $DAEMON; then - kill $PID >/dev/null 2>&1 - if [[ $? != 0 ]]; then - stat_fail - else - rm_daemon $DAEMON - stat_done - fi - else - stat_fail - fi - ;; - purge) - stat_busy "Purging $DAEMON" - [[ ! -d /var/run/$DAEMON ]] && install -d $DAEMON /var/run/$DAEMON - if ! ck_daemon $DAEMON; then - kill -USR1 $PID >/dev/null 2>&1 - sleep 1 - /usr/bin/$DAEMON -x $ARGS >/dev/null 2>&1 || stat_fail - kill -USR2 $PID >/dev/null 2>&1 - stat_done - else - /usr/bin/$DAEMON -x $ARGS >/dev/null 2>&1 || stat_fail - stat_done - fi - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart|purge}" - ;; + stop) + stat_busy "Stopping $daemon_name daemon" + PID=$(get_pid) + # KILL + [[ -n $PID ]] && kill $PID &> /dev/null + # + if [[ $? -gt 0 ]]; then + stat_fail + exit 1 + else + rm -f /run/$daemon_name.pid &> /dev/null + rm_daemon $daemon_name + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + status) + stat_busy "Checking $daemon_name status"; + ck_status $daemon_name + ;; + + *) + echo "usage: $0 {start|stop|restart|status}" esac + +exit 0 + +# vim:set ts=2 sw=2 et: diff --git a/community/polipo/polipo.service b/community/polipo/polipo.service new file mode 100644 index 000000000..a1bdd9aa2 --- /dev/null +++ b/community/polipo/polipo.service @@ -0,0 +1,10 @@ +[Unit] +Description=Polipo Proxy Server + +[Service] +ExecStart=/usr/bin/polipo +User=nobody +ExecReload=/bin/kill -USR1 $MAINPID + +[Install] +WantedBy=multi-user.target |