e2guardian: Update init script 8103/head
authorJeffery To <jeffery.to@gmail.com>
Fri, 1 Feb 2019 08:55:13 +0000 (16:55 +0800)
committerJeffery To <jeffery.to@gmail.com>
Fri, 1 Feb 2019 08:55:13 +0000 (16:55 +0800)
This replaces the use of uci_validate_section() with
uci_load_validate(), which removes the need to declare local variables
for every config option.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
net/e2guardian/Makefile
net/e2guardian/files/e2guardian.init

index 2628711ea43601a5757d5cb637a38280a79367e5..5fd458ae370b88c77de33fc923b93cbcb153abdf 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=e2guardian
 PKG_VERSION:=3.2.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=GPL-2.0
 PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
index 4a5981e869a907204976bcaf3aa86b75fc884e71..b4c236e4083521c93c6bf56175a1525e7dbedc1d 100644 (file)
@@ -11,7 +11,7 @@ LOGFILE="/tmp/e2guardian/access.log"
 GROUPCONFIG="/tmp/e2guardian/e2guardianf1.conf"
 
 validate_e2guardian_section() {
-       uci_validate_section e2guardian e2guardian "${1}" \
+       uci_load_validate e2guardian e2guardian "$1" "$2" \
                'accessdeniedaddress:string' \
                'bannediplist:string' \
                'contentscanexceptions:string' \
@@ -83,22 +83,9 @@ validate_e2guardian_section() {
                'weightedphrasemode:range(0,2)'
 }
 
-start_service() {
-
-       local accessdeniedaddress bannediplist contentscanexceptions contentscanner contentscannertimeout \
-               createlistcachefiles custombannedflashfile custombannedimagefile deletedownloadedtempfiles \
-               downloadmanager exceptioniplist filecachedir loglocation \
-               filtergroups filtergroupslist filterip filterports forcequicksearch forwardedfor hexdecodecontent \
-               initialtrickledelay ipcfilename ipipcfilename language languagedir logadblocks logchildprocesshandling \
-               logclienthostnames logconnectionhandlingerrors logexceptionhits logfileformat loglevel loguseragent \
-               maxagechildren maxchildren maxcontentfilecachescansize maxcontentfiltersize maxcontentramcachescansize \
-               maxips maxsparechildren maxuploadsize minchildren minsparechildren nodaemon nologger \
-               pcontimeout perroomdirectory phrasefiltermode prefercachedlists preforkchildren preservecase proxyexchange \
-               proxyip proxyport proxytimeout recheckreplacedurls reverseaddresslookups reverseclientiplookups scancleancache \
-               showweightedfound softrestart trickledelay urlcacheage urlcachenumber urlipcfilename usecustombannedflash \
-               usecustombannedimage usexforwardedfor weightedphrasemode
-
-       validate_e2guardian_section e2guardian || {
+start_e2guardian_instance() {
+
+       [ "$2" = 0 ] || {
                echo "validation failed"
                return 1
        }
@@ -198,6 +185,11 @@ start_service() {
 
 }
 
+start_service()
+{
+       validate_e2guardian_section e2guardian start_e2guardian_instance
+}
+
 stop_service()
 {
        PID=`cat /tmp/e2guardian/e2guardian.pid`