This commit is contained in:
parent
7b81f5a1ea
commit
8f67cf68cb
19
start.sh
19
start.sh
@ -41,16 +41,21 @@ for country in $COUNTRIES; do #https://www.ipdeny.com/ipblocks/data/countries/${
|
|||||||
url="https://raw.githubusercontent.com/firehol/blocklist-ipsets/refs/heads/master/geolite2_country/country_${country}.netset" #
|
url="https://raw.githubusercontent.com/firehol/blocklist-ipsets/refs/heads/master/geolite2_country/country_${country}.netset" #
|
||||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Baixando lista IPs: $country"
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Baixando lista IPs: $country"
|
||||||
|
|
||||||
|
tmp_file2="${ZONE_DIR}/${country}.zone.tmp2"
|
||||||
tmp_file="${ZONE_DIR}/${country}.zone.tmp"
|
tmp_file="${ZONE_DIR}/${country}.zone.tmp"
|
||||||
target_file="${ZONE_DIR}/${country}.zone"
|
target_file="${ZONE_DIR}/${country}.zone"
|
||||||
|
|
||||||
if curl -sSf -o "$tmp_file" "$url"; then
|
if curl -sSf -o "$tmp_file2" "$url"; then
|
||||||
grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$' "$tmp_file" > "$target_file"
|
grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(/[0-9]+)?$' "$tmp_file2" > "$tmp_file"
|
||||||
rm "$tmp_file"
|
rm "$tmp_file2"
|
||||||
if [ ! -s "$target_file" ]; then
|
|
||||||
echo "[$country] Lista filtrada vazia, ignorando atualização."
|
|
||||||
rm "$target_file"
|
if [ -f "$target_file" ] && cmp -s "$tmp_file" "$target_file"; then
|
||||||
continue
|
echo "[$country] Arquivo inalterado."
|
||||||
|
rm "$tmp_file"
|
||||||
|
else
|
||||||
|
echo "[$country] Atualizando IPs."
|
||||||
|
mv "$tmp_file" "$target_file"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "[$country] Falha no download. Mantendo antigo (se existir)."
|
echo "[$country] Falha no download. Mantendo antigo (se existir)."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user