From 5df9b5d109312e8b9f2079a43038a8755e446363 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 22 Dec 2024 13:10:06 +0300 Subject: [PATCH] ipset: script maintenance --- ipset/def.sh | 12 ++++++++++++ ipset/get_reestr_preresolved.sh | 2 +- ipset/get_reestr_preresolved_smart.sh | 2 +- ipset/get_reestr_resolvable_domains.sh | 2 +- ipset/get_refilter_domains.sh | 2 +- ipset/get_refilter_ipsum.sh | 3 +-- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ipset/def.sh b/ipset/def.sh index 4d8b7c1..9c9667f 100644 --- a/ipset/def.sh +++ b/ipset/def.sh @@ -141,6 +141,18 @@ zzsize() printf 0 fi } +zzcopy() +{ + local is_gz=0 + zztest "$1" && is_gz=1 + if [ "$GZIP_LISTS" = 1 -a $is_gz = 1 ]; then + cp "$1" "${2}.gz" + elif [ "$GZIP_LISTS" != 1 -a $is_gz != 1 ]; then + cp "$1" "$2" + else + zzcat "$1" | zz "$2" + fi +} digger() { diff --git a/ipset/get_reestr_preresolved.sh b/ipset/get_reestr_preresolved.sh index 6e530e7..4bdee95 100755 --- a/ipset/get_reestr_preresolved.sh +++ b/ipset/get_reestr_preresolved.sh @@ -29,7 +29,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zzcat "$TMPLIST" | zz "$2" + zzcopy "$TMPLIST" "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_reestr_preresolved_smart.sh b/ipset/get_reestr_preresolved_smart.sh index d31c0b3..3507bb9 100755 --- a/ipset/get_reestr_preresolved_smart.sh +++ b/ipset/get_reestr_preresolved_smart.sh @@ -29,7 +29,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zzcat "$TMPLIST" | zz "$2" + zzcopy "$TMPLIST" "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_reestr_resolvable_domains.sh b/ipset/get_reestr_resolvable_domains.sh index 3a213ff..2821446 100755 --- a/ipset/get_reestr_resolvable_domains.sh +++ b/ipset/get_reestr_resolvable_domains.sh @@ -28,7 +28,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zzcat "$TMPLIST" | zz "$2" + zzcopy "$TMPLIST" "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_refilter_domains.sh b/ipset/get_refilter_domains.sh index 807c025..c61c867 100755 --- a/ipset/get_refilter_domains.sh +++ b/ipset/get_refilter_domains.sh @@ -25,7 +25,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - zzcat "$TMPLIST" | zz "$2" + zzcopy "$TMPLIST" "$2" rm -f "$TMPLIST" } diff --git a/ipset/get_refilter_ipsum.sh b/ipset/get_refilter_ipsum.sh index f5dd192..5f15ed0 100755 --- a/ipset/get_refilter_ipsum.sh +++ b/ipset/get_refilter_ipsum.sh @@ -25,8 +25,7 @@ dl() echo list is too small : $dlsize bytes. can be bad. exit 2 fi - # remove DOS EOL \r - zzcat "$TMPLIST" | zz "$2" + zzcopy "$TMPLIST" "$2" rm -f "$TMPLIST" }