From bb146dfde823eb85f469568e86473fbfdcad6cc0 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Wed, 16 Nov 2011 09:44:13 +0000 Subject: [PATCH] packages/tinyproxy: use new service functions, change 'enable' option to 'enabled' like most other services are using SVN-Revision: 29173 --- net/tinyproxy/Makefile | 2 +- net/tinyproxy/files/tinyproxy.config | 2 +- net/tinyproxy/files/tinyproxy.init | 23 +++++++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/net/tinyproxy/Makefile b/net/tinyproxy/Makefile index e6daa1e0b..a6b61ce0d 100644 --- a/net/tinyproxy/Makefile +++ b/net/tinyproxy/Makefile @@ -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/ diff --git a/net/tinyproxy/files/tinyproxy.config b/net/tinyproxy/files/tinyproxy.config index ffccc4072..dc4fb4f9c 100644 --- a/net/tinyproxy/files/tinyproxy.config +++ b/net/tinyproxy/files/tinyproxy.config @@ -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 diff --git a/net/tinyproxy/files/tinyproxy.init b/net/tinyproxy/files/tinyproxy.init index cff10c083..be7234a57 100644 --- a/net/tinyproxy/files/tinyproxy.init +++ b/net/tinyproxy/files/tinyproxy.init @@ -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() { -- 2.30.2