Merge pull request #3374 from chris5560/master
privoxy: fix handling config section "system"
This commit is contained in:
commit
b2c66cf412
2 changed files with 37 additions and 31 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=privoxy
|
PKG_NAME:=privoxy
|
||||||
PKG_VERSION:=3.0.26
|
PKG_VERSION:=3.0.26
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=privoxy-$(PKG_VERSION)-stable-src.tar.gz
|
PKG_SOURCE:=privoxy-$(PKG_VERSION)-stable-src.tar.gz
|
||||||
PKG_SOURCE_URL:=@SF/ijbswa
|
PKG_SOURCE_URL:=@SF/ijbswa
|
||||||
|
@ -151,7 +151,7 @@ define Package/$(PKG_NAME)/install
|
||||||
$(1)/etc/config
|
$(1)/etc/config
|
||||||
$(INSTALL_DATA) ./files/privoxy.upgrade $(1)/lib/upgrade/keep.d/privoxy
|
$(INSTALL_DATA) ./files/privoxy.upgrade $(1)/lib/upgrade/keep.d/privoxy
|
||||||
$(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
|
$(INSTALL_BIN) ./files/privoxy.init $(1)/etc/init.d/privoxy
|
||||||
$(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/80-privoxy
|
$(INSTALL_BIN) ./files/privoxy.hotplug $(1)/etc/hotplug.d/iface/95-privoxy
|
||||||
$(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
|
$(INSTALL_CONF) ./files/privoxy.config $(1)/etc/config/privoxy
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=80
|
START=95
|
||||||
STOP=20
|
STOP=10
|
||||||
|
|
||||||
PIDFILE=/var/run/privoxy.pid
|
PIDFILE=/var/run/privoxy.pid
|
||||||
CFGFILE=/var/etc/privoxy.conf
|
CFGFILE=/var/etc/privoxy.conf
|
||||||
|
@ -9,32 +9,38 @@ CFGTEMP=/var/etc/privoxy.conf.tmp
|
||||||
|
|
||||||
_uci2conf() {
|
_uci2conf() {
|
||||||
# redefined callback for options when calling config_load
|
# redefined callback for options when calling config_load
|
||||||
option_cb()
|
config_cb() {
|
||||||
{
|
if [ ."$2" != ."privoxy" ]; then
|
||||||
# $1 name of variable
|
option_cb() { return 0; }
|
||||||
# $2 value
|
else
|
||||||
local __OPT="$1"
|
option_cb()
|
||||||
local __VAL="$2"
|
{
|
||||||
case $__OPT in
|
# $1 name of variable
|
||||||
confdir|templdir|temporary_directory|logdir|logfile)
|
# $2 value
|
||||||
# needs to be handled separately because we need to set permissions
|
local __OPT="$1"
|
||||||
# AND needs to be defined first because of a BUG inside privoxy
|
local __VAL="$2"
|
||||||
# require directories to be defined first inside config
|
case $__OPT in
|
||||||
;;
|
confdir|templdir|temporary_directory|logdir|logfile)
|
||||||
debug_*)
|
# needs to be handled separately because we need to set permissions
|
||||||
[ $__VAL -eq 0 ] && return # not set ignore
|
# AND needs to be defined first because of a BUG inside privoxy
|
||||||
echo -e "debug\t$(echo $__OPT | sed -e 's#debug_##g')" >> $CFGTEMP ;;
|
# require directories to be defined first inside config
|
||||||
*)
|
;;
|
||||||
# detect list options (LENGTH) and ignore
|
debug_*)
|
||||||
echo $__OPT | grep -i "_LENGTH" >/dev/null 2>&1 && return
|
[ $__VAL -eq 0 ] && return # not set ignore
|
||||||
# detect list options (ITEM) and ignore
|
echo -e "debug\t$(echo $__OPT | sed -e 's#debug_##g')" >> $CFGTEMP ;;
|
||||||
echo $__OPT | grep -i "_ITEM" >/dev/null 2>&1 && __OPT=$(echo $__OPT | sed -e "s#_ITEM.*##g")
|
*)
|
||||||
# uci only accept "_" but we need "-"
|
# detect list options (LENGTH) and ignore
|
||||||
local __OPT=$(echo $__OPT | sed -e "s#_#-#g")
|
echo $__OPT | grep -i "_LENGTH" >/dev/null 2>&1 && return
|
||||||
# write to config
|
# detect list options (ITEM) and ignore
|
||||||
echo -e "$__OPT\t$__VAL" >> $CFGTEMP
|
echo $__OPT | grep -i "_ITEM" >/dev/null 2>&1 && __OPT=$(echo $__OPT | sed -e "s#_ITEM.*##g")
|
||||||
;;
|
# uci only accept "_" but we need "-"
|
||||||
esac
|
local __OPT=$(echo $__OPT | sed -e "s#_#-#g")
|
||||||
|
# write to config
|
||||||
|
echo -e "$__OPT\t$__VAL" >> $CFGTEMP
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# temporary config file
|
# temporary config file
|
||||||
|
@ -92,7 +98,7 @@ _uci2conf() {
|
||||||
echo -e "temporary-directory\t$_TMP_DIR" >> $CFGTEMP
|
echo -e "temporary-directory\t$_TMP_DIR" >> $CFGTEMP
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_load privoxy # calling above option_cb() and write the rest into $CFGTEMP
|
config_load "privoxy" # calling above option_cb() and write the rest into $CFGTEMP
|
||||||
|
|
||||||
# move temp to final privoxy readable configuration
|
# move temp to final privoxy readable configuration
|
||||||
mv -f $CFGTEMP $CFGFILE
|
mv -f $CFGTEMP $CFGFILE
|
||||||
|
|
Loading…
Reference in a new issue