Compare commits

...

4 Commits

Author SHA1 Message Date
bol-van
6ac84b85fb blockcheck: tolerate absense of config and config.default 2024-07-30 17:41:50 +03:00
bol-van
68061b61ae blockcheck: tolerate absense of config and config.default 2024-07-30 17:37:28 +03:00
bol-van
22a772e96b remove changeable files from ipset 2024-07-30 17:25:15 +03:00
bol-van
cf1d6f537b remove changable files from git 2024-07-30 16:58:24 +03:00
11 changed files with 40 additions and 5 deletions

View File

@ -2,9 +2,13 @@
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
ZAPRET_CONFIG="$EXEDIR/config"
ZAPRET_BASE="$EXEDIR"
[ -f "$ZAPRET_BASE/config" ] && . "$ZAPRET_BASE/config"
[ -f "$ZAPRET_CONFIG" ] || {
[ -f "${ZAPRET_CONFIG}.default" ] && cp "${ZAPRET_CONFIG}.default" "$ZAPRET_CONFIG"
}
[ -f "$ZAPRET_CONFIG" ] && . "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/dialog.sh"
. "$ZAPRET_BASE/common/elevate.sh"

View File

@ -21,8 +21,16 @@
АЛЬТЕРНАТИВА : make -C /opt/zapret. Получите динамические бинарики под вашу ось.
Для сборки требуются dev пакеты : zlib1g-dev libcap-dev libnetfilter-queue-dev
Создать конфиг по умолчанию :
cp /opt/zapret/config.default /opt/zapret/config
Настроить параметры согласно разделу "Выбор параметров".
Создать user листы по умолчанию :
cp /opt/zapret/ipset/zapret-hosts-user-exclude.txt.default /opt/zapret/ipset/zapret-hosts-user-exclude.txt
echo nonexistent.domain >/opt/zapret/ipset/zapret-hosts-user.txt
touch /opt/zapret/ipset/zapret-hosts-user-ipban.txt
Создать ссылку на service unit в systemd :
ln -fs /opt/zapret/init.d/systemd/zapret.service /lib/systemd/system
@ -209,8 +217,16 @@ curl можно выкинуть, если для получения ip лист
Создать ссылку на скрипт события поднятия интерфейса :
ln -fs /opt/zapret/init.d/openwrt/90-zapret /etc/hotplug.d/iface
Создать конфиг по умолчанию :
cp /opt/zapret/config.default /opt/zapret/config
Настроить параметры согласно разделу "Выбор параметров".
Создать user листы по умолчанию :
cp /opt/zapret/ipset/zapret-hosts-user-exclude.txt.default /opt/zapret/ipset/zapret-hosts-user-exclude.txt
echo nonexistent.domain >/opt/zapret/ipset/zapret-hosts-user.txt
touch /opt/zapret/ipset/zapret-hosts-user-ipban.txt
Удалить старые листы, если они были созданы ранее :
/opt/zapret/ipset/clear_lists.sh
По желанию прописать в /opt/zapret/ipset/zapret-hosts-user.txt свои домены.

View File

@ -8,6 +8,7 @@ IPSET_DIR="$EXEDIR/ipset"
ZAPRET_CONFIG="$EXEDIR/config"
ZAPRET_BASE="$EXEDIR"
[ -f "$ZAPRET_CONFIG" ] || cp "${ZAPRET_CONFIG}.default" "$ZAPRET_CONFIG"
. "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/elevate.sh"
@ -375,15 +376,29 @@ select_mode_iface()
esac
}
ipset_default_files()
{
[ -f "$1/ipset/$file/zapret-hosts-user-exclude.txt" ] || cp "$1/ipset/$file/zapret-hosts-user-exclude.txt.default" "$1/ipset/$file/zapret-hosts-user-exclude.txt"
[ -f "$1/ipset/$file/zapret-hosts-user.txt" ] || echo nonexistent.domain >> "$1/ipset/$file/zapret-hosts-user.txt"
[ -f "$1/ipset/$file/zapret-hosts-user-ipban.txt" ] || touch "$1/ipset/$file/zapret-hosts-user-ipban.txt"
}
copy_all()
{
local dir
cp -R "$1" "$2"
[ -d "$2/tmp" ] || mkdir "$2/tmp"
for dir in openwrt sysv macos; do
[ -f "$2/init.d/$dir/custom" ] || cp "$2/init.d/$dir/custom.default" "$2/init.d/$dir/custom"
done
ipset_default_files "$2"
}
copy_openwrt()
{
local ARCH="$(get_bin_arch)"
local BINDIR="$1/binaries/$ARCH"
local file
[ -d "$2" ] || mkdir -p "$2"
@ -391,7 +406,9 @@ copy_openwrt()
cp -R "$1/files/fake" "$2/files"
cp -R "$1/common" "$1/ipset" "$2"
cp -R "$1/init.d/openwrt" "$2/init.d"
cp "$1/config" "$1/install_easy.sh" "$1/uninstall_easy.sh" "$1/install_bin.sh" "$1/install_prereq.sh" "$1/blockcheck.sh" "$2"
[ -f "$2/init.d/openwrt/custom" ] || cp "$2/init.d/openwrt/custom.default" "$2/init.d/openwrt/custom"
ipset_default_files "$2"
cp "$1/config" "$1/config.default" "$1/install_easy.sh" "$1/uninstall_easy.sh" "$1/install_bin.sh" "$1/install_prereq.sh" "$1/blockcheck.sh" "$2"
cp "$BINDIR/tpws" "$BINDIR/nfqws" "$BINDIR/ip2net" "$BINDIR/mdig" "$2/binaries/$ARCH"
}

View File

@ -7,7 +7,7 @@ EXEDIR="$(cd "$EXEDIR"; pwd)"
ZAPRET_CONFIG="$EXEDIR/config"
ZAPRET_BASE="$EXEDIR"
. "$ZAPRET_CONFIG"
[ -f "$ZAPRET_CONFIG" ] || cp "${ZAPRET_CONFIG}.default" "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/elevate.sh"
. "$ZAPRET_BASE/common/fwtype.sh"

View File

@ -1 +0,0 @@
pornhub.com

View File

@ -1 +0,0 @@
kinozal.tv