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_NAME:=tinyproxy
PKG_VERSION:=1.8.2 PKG_VERSION:=1.8.2
PKG_RELEASE:=4 PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.banu.com/pub/tinyproxy/1.8/ PKG_SOURCE_URL:=http://www.banu.com/pub/tinyproxy/1.8/

View File

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

View File

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