diff --git a/blockcheck.sh b/blockcheck.sh index 6ff86f0..637caff 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -2,9 +2,11 @@ EXEDIR="$(dirname "$0")" EXEDIR="$(cd "$EXEDIR"; pwd)" +ZAPRET_CONFIG="$EXEDIR/config" ZAPRET_BASE="$EXEDIR" -[ -f "$ZAPRET_BASE/config" ] && . "$ZAPRET_BASE/config" +[ -f "$ZAPRET_CONFIG" ] || 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" diff --git a/config b/config.default similarity index 100% rename from config rename to config.default diff --git a/docs/manual_setup.txt b/docs/manual_setup.txt index ec8b47a..fe45c1c 100644 --- a/docs/manual_setup.txt +++ b/docs/manual_setup.txt @@ -21,6 +21,9 @@ АЛЬТЕРНАТИВА : make -C /opt/zapret. Получите динамические бинарики под вашу ось. Для сборки требуются dev пакеты : zlib1g-dev libcap-dev libnetfilter-queue-dev +Создать конфиг по умолчанию : + cp /opt/zapret/config.default /opt/zapret/config + Настроить параметры согласно разделу "Выбор параметров". Создать ссылку на service unit в systemd : @@ -209,6 +212,9 @@ curl можно выкинуть, если для получения ip лист Создать ссылку на скрипт события поднятия интерфейса : ln -fs /opt/zapret/init.d/openwrt/90-zapret /etc/hotplug.d/iface +Создать конфиг по умолчанию : + cp /opt/zapret/config.default /opt/zapret/config + Настроить параметры согласно разделу "Выбор параметров". Удалить старые листы, если они были созданы ранее : diff --git a/init.d/macos/custom b/init.d/macos/custom.default similarity index 100% rename from init.d/macos/custom rename to init.d/macos/custom.default diff --git a/init.d/openwrt/custom b/init.d/openwrt/custom.default similarity index 100% rename from init.d/openwrt/custom rename to init.d/openwrt/custom.default diff --git a/init.d/sysv/custom b/init.d/sysv/custom.default similarity index 100% rename from init.d/sysv/custom rename to init.d/sysv/custom.default diff --git a/install_easy.sh b/install_easy.sh index 9e4b753..0c2d852 100755 --- a/install_easy.sh +++ b/install_easy.sh @@ -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" @@ -377,8 +378,13 @@ select_mode_iface() 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 } copy_openwrt() { @@ -391,7 +397,8 @@ 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" + 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" } diff --git a/install_prereq.sh b/install_prereq.sh index b345c35..f757358 100755 --- a/install_prereq.sh +++ b/install_prereq.sh @@ -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"