don't download filter rules if file already exists

This commit is contained in:
Konstantin Zamyakin 2018-10-31 15:46:02 +03:00
parent 32de112d97
commit e28703b7b8

View File

@ -13,15 +13,21 @@ case "$1" in
--gecos "<%= project %> user" \
--shell /bin/bash "<%= user %>"
fi
URL="https://filters.adtidy.org/android/filters/15.txt"
OUTFILE="/var/lib/dnsfilter/dns.txt"
if [ ! -f "${OUTFILE}" ]; then
echo "${OUTFILE} does not exists. Downloading..."
URL="https://filters.adtidy.org/android/filters/15.txt"
mkdir -p /var/lib/dnsfilter
wget -q --timeout=90 "$URL" -O "$OUTFILE"
if [ $? -ne 0 ]
then
echo "Filter rules could not be downloaded."
fi
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2