From fe7cfad79744a2e1b64b2157ea4b94b1d2713f52 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 31 Oct 2021 10:19:20 +0300 Subject: [PATCH] init.d,ipset: ability to specify custom binaries location --- init.d/macos/functions | 2 +- init.d/openwrt/zapret | 4 ++-- init.d/sysv/functions | 4 ++-- ipset/create_ipset.sh | 6 +++--- ipset/def.sh | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/init.d/macos/functions b/init.d/macos/functions index 85cce3e..50c3b46 100644 --- a/init.d/macos/functions +++ b/init.d/macos/functions @@ -12,7 +12,7 @@ PIDDIR=/var/run TPWS_USER=daemon TPWS_WAIT="--bind-wait-ifup=30 --bind-wait-ip=30" TPWS_WAIT_SOCKS6="$TPWS_WAIT --bind-wait-ip-linklocal=30" -TPWS="$ZAPRET_BASE/tpws/tpws" +[ -n "$TPWS" ] || TPWS="$ZAPRET_BASE/tpws/tpws" PF_MAIN="/etc/pf.conf" PF_ANCHOR_DIR=/etc/pf.anchors diff --git a/init.d/openwrt/zapret b/init.d/openwrt/zapret index cf565e4..f00db54 100755 --- a/init.d/openwrt/zapret +++ b/init.d/openwrt/zapret @@ -20,10 +20,10 @@ fi PIDDIR=/var/run NFQWS_USER=daemon -NFQWS="$ZAPRET_BASE/nfq/nfqws" +[ -n "$NFQWS" ] || NFQWS="$ZAPRET_BASE/nfq/nfqws" NFQWS_OPT_BASE="--user=$NFQWS_USER --dpi-desync-fwmark=$DESYNC_MARK" -TPWS="$ZAPRET_BASE/tpws/tpws" +[ -n "$TPWS" ] || TPWS="$ZAPRET_BASE/tpws/tpws" TPWS_LOCALHOST4=127.0.0.127 HOSTLIST="$ZAPRET_BASE/ipset/zapret-hosts.txt.gz" [ -f "$HOSTLIST" ] || HOSTLIST="$ZAPRET_BASE/ipset/zapret-hosts.txt" diff --git a/init.d/sysv/functions b/init.d/sysv/functions index 0682fe1..f9af75b 100644 --- a/init.d/sysv/functions +++ b/init.d/sysv/functions @@ -11,13 +11,13 @@ IPSET_CR="$ZAPRET_BASE/ipset/create_ipset.sh" WS_USER=tpws [ -n "$QNUM" ] || QNUM=200 -NFQWS="$ZAPRET_BASE/nfq/nfqws" +[ -n "$NFQWS" ] || NFQWS="$ZAPRET_BASE/nfq/nfqws" NFQWS_OPT_BASE="--user=$WS_USER --dpi-desync-fwmark=$DESYNC_MARK" NFQWS_OPT_DESYNC_HTTP="${NFQWS_OPT_DESYNC_HTTP:-$NFQWS_OPT_DESYNC}" NFQWS_OPT_DESYNC_HTTPS="${NFQWS_OPT_DESYNC_HTTPS:-$NFQWS_OPT_DESYNC}" [ -n "$TPPORT" ] || TPPORT=988 -TPWS="$ZAPRET_BASE/tpws/tpws" +[ -n "$TPWS" ] || TPWS="$ZAPRET_BASE/tpws/tpws" TPWS_LOCALHOST4=127.0.0.127 HOSTLIST="$ZAPRET_BASE/ipset/zapret-hosts.txt.gz" [ -f "$HOSTLIST" ] || HOSTLIST="$ZAPRET_BASE/ipset/zapret-hosts.txt" diff --git a/ipset/create_ipset.sh b/ipset/create_ipset.sh index 83701d6..d0281f3 100755 --- a/ipset/create_ipset.sh +++ b/ipset/create_ipset.sh @@ -63,9 +63,9 @@ ipset_restore() # do not saveram small files. file can also be gzipped [ "$SAVERAM" = "1" ] && [ "$fsize" -ge "$IPSET_SAVERAM_MIN_FILESIZE" ] && svram=1 - local T="Adding to ipset $2 ($IPSTYPE" - [ "$svram" = "1" ] && T="$T, saveram" - T="$T) : $f" + local T="Adding to ipset $2 " + [ "$svram" = "1" ] && T="$T (saveram)" + T="$T : $f" echo $T if [ "$svram" = "1" ]; then diff --git a/ipset/def.sh b/ipset/def.sh index 878511f..6cdae24 100644 --- a/ipset/def.sh +++ b/ipset/def.sh @@ -38,8 +38,8 @@ ZUSERLIST_IPBAN="$IPSET_DIR/zapret-hosts-user-ipban.txt" ZUSERLIST_EXCLUDE="$IPSET_DIR/zapret-hosts-user-exclude.txt" -IP2NET="$IPSET_DIR/../ip2net/ip2net" -MDIG="$IPSET_DIR/../mdig/mdig" +[ -n "$IP2NET" ] || IP2NET="$IPSET_DIR/../ip2net/ip2net" +[ -n "$MDIG" ] || MDIG="$IPSET_DIR/../mdig/mdig" [ -z "$MDIG_THREADS" ] && MDIG_THREADS=30