packages/tinyproxy: use new service functions, change 'enable' option to 'enabled' like most other services are using

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29173 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-16 09:44:13 +00:00
parent 4fb5622c35
commit e59863de27
3 changed files with 15 additions and 12 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=tinyproxy
PKG_VERSION:=1.8.2
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.banu.com/pub/tinyproxy/1.8/

View File

@ -3,7 +3,7 @@ config tinyproxy
#
# Enable the proxy
#
option enable 0
option enabled 0
#
# Name of the user the tinyproxy daemon should switch to after the port

View File

@ -1,25 +1,28 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
# Copyright (C) 2008-2011 OpenWrt.org
START=50
DAEMON=/usr/sbin/tinyproxy
CFGFILE=/var/etc/tinyproxy.conf
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
start() {
config_load tinyproxy
config_foreach start_proxy tinyproxy
config_load 'tinyproxy'
config_foreach start_proxy 'tinyproxy'
}
stop() {
start-stop-daemon -q -x "$DAEMON" -K
rm -f $CFGFILE
service_stop /usr/sbin/tinyproxy
}
start_proxy() {
config_get_bool enable "$1" enable
[ "$enable" -eq "1" ] || return 0
section_enabled "$1" || return 1
mkdir -p /var/etc
mkdir -m0755 -p /var/etc
echo '### AUTOGENERATED CONFIGURATION' > $CFGFILE
echo '### DO NOT EDIT' >> $CFGFILE
echo '### SEE /etc/config/tinyproxy INSTEAD' >> $CFGFILE
@ -69,7 +72,7 @@ start_proxy() {
config_foreach write_upstream upstream
start-stop-daemon -q -x "$DAEMON" -S -- -c "$CFGFILE"
service_start /usr/sbin/tinyproxy -c "$CFGFILE"
}
write_upstream() {