quick fix for when dig also returns a CNAME

Signed-off-by: Andreas <ryrun@online.de>
This commit is contained in:
Andreas 2019-08-04 21:21:08 +02:00 committed by Dan Schaper
parent ab1ea5a366
commit c53be459c6
No known key found for this signature in database
GPG Key ID: B4FF14C01CC08DC0
1 changed files with 1 additions and 1 deletions

View File

@ -263,7 +263,7 @@ gravity_DownloadBlocklistFromUrl() {
else
printf -v port "%s" "${PIHOLE_DNS_1#*#}"
fi
ip=$(dig "@${ip_addr}" -p "${port}" +short "${domain}")
ip=$(dig "@${ip_addr}" -p "${port}" +short "${domain}" | tail -1)
if [[ $(echo "${url}" | awk -F '://' '{print $1}') = "https" ]]; then
port=443;
else port=80