packages/polipo: use new service functions

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29139 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-14 23:30:55 +00:00
parent 40bd40c0d4
commit 306b6a1f1e
2 changed files with 14 additions and 26 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2007 OpenWrt.org
# Copyright (C) 2007-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=polipo
PKG_VERSION:=1.0.4.1
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://freehaven.net/~chrisd/polipo/

View File

@ -1,47 +1,35 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2008-2011 OpenWrt.org
START=99
DAEMON=/usr/sbin/polipo
CFGFILE=/var/etc/polipo.conf
start() {
config_load polipo
config_load 'polipo'
config_get_bool enabled "general" enabled
[ "$enabled" -ne "1" ] && {
echo 'Polipo is disabled.'
return 0
}
config_get_bool enabled "general" 'enabled' '0'
[ $enabled -gt 0 ] || return 1
mkdir -p /var/etc/
mkdir -m 0755 -p /var/etc/
echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
echo '### DO NOT EDIT' >> $CFGFILE
echo '### SEE /etc/config/polipo INSTEAD' >> $CFGFILE
echo '' >> $CFGFILE
config_foreach polipo_config polipo
# handle values that are disabled when not defiend or empty
config_foreach polipo_config 'polipo'
# handle values that are disabled when not defined or empty
echo "### VALUES THAT ARE DISABLED WHEN EMPTY" >> $CFGFILE
polipo_atom "cache" "diskCacheRoot" '"' "1" >> $CFGFILE
polipo_atom "general" "logFile" '"' "1" >> $CFGFILE
polipo_atom "general" "localDocumentRoot" '"' "1" >> $CFGFILE
echo 'Polipo is starting...'
start-stop-daemon -S -q -x "$DAEMON" -- -c "$CFGFILE"
service_start /usr/sbin/polipo -c "$CFGFILE"
}
stop() {
echo 'Polipo is stopping...'
start-stop-daemon -K -q -x "$DAEMON"
rm -f $CFGFILE
}
restart() {
stop
sleep 2
start
service_stop /usr/sbin/polipo -c "$CFGFILE"
}
polipo_config() {