#!/bin/bash set -euxo pipefail git submodule update --init --recursive workdir=$(dirname "$0") build_dir="$workdir/.build" path_az=$(realpath antizapret-pac-generator-light) path_geoip=$(realpath geoip) path_geosite=$(realpath domain-list-community) path_data=$(realpath data) # Initialize build dir mkdir -p "$build_dir" # Initialize antizapret data cd "$path_az" patch --forward < "$path_data/az-cyrillic-idn-fix.patch" || true bash update.sh bash parse.sh cd "$workdir" # Generate geoip.dat cat "$path_data/geoip-generator-config.json" > "$path_geoip/config.json" mkdir -p "$path_geoip/data" cp "$path_az/result/iplist_all.txt" "$path_geoip/data/ru-blocked-ips-all" cp "$path_az/result/iplist_blockedbyip.txt" "$path_geoip/data/ru-blocked-ips-directblock" cp "$path_az/result/iplist_blockedbyip_noid2971.txt" "$path_geoip/data/ru-blocked-ips-noid2971" ([ ! -f "$path_geoip/geoip-src.dat" ] && curl -fsSL https://github.com/v2fly/geoip/releases/latest/download/geoip.dat -o "$path_geoip/geoip-src.dat") cd "$path_geoip" && go run ./ && cd "$workdir" mv "$path_geoip/output/dat/geoip.dat" "$build_dir/geoip.dat" # Generate geosite.dat cp "$path_az/result/hostlist_zones.txt" "$path_geosite/data/category-ru-blocked-zones" cp "$path_az/result/hostlist_original.txt" "$path_geosite/data/category-ru-blocked-domains" cd "$path_geosite" && go run ./ --outputdir="$build_dir" --outputname=geosite.dat && cd "$workdir"