Update install.func
This commit is contained in:
parent
c7ba6705aa
commit
ae4fcc9546
@ -96,6 +96,7 @@ network_check() {
|
|||||||
ipv4_connected=false
|
ipv4_connected=false
|
||||||
ipv6_connected=false
|
ipv6_connected=false
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Check IPv4 connectivity to Google, Cloudflare & Quad9 DNS servers.
|
# Check IPv4 connectivity to Google, Cloudflare & Quad9 DNS servers.
|
||||||
if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then
|
if ping -c 1 -W 1 1.1.1.1 &>/dev/null || ping -c 1 -W 1 8.8.8.8 &>/dev/null || ping -c 1 -W 1 9.9.9.9 &>/dev/null; then
|
||||||
msg_ok "IPv4 Internet Connected"
|
msg_ok "IPv4 Internet Connected"
|
||||||
@ -123,12 +124,20 @@ network_check() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# DNS resolution checks for GitHub-related domains (IPv4 and/or IPv6)
|
||||||
GITHUB_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com")
|
GITHUB_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com")
|
||||||
|
|
||||||
for HOST in "${GITHUB_HOSTS[@]}"; do
|
for HOST in "${GITHUB_HOSTS[@]}"; do
|
||||||
RESOLVEDIP=$(getent hosts "$HOST" | awk '{ print $1 }')
|
RESOLVEDIP=""
|
||||||
if [[ -z "$RESOLVEDIP" || (! "$RESOLVEDIP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ && ! "$RESOLVEDIP" =~ ^([a-fA-F0-9:]+)$) ]]; then
|
while read -r IP; do
|
||||||
msg_error "DNS resolution failed or invalid IP for $HOST"
|
if [[ "$IP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ || "$IP" =~ ^[a-fA-F0-9:]+$ ]]; then
|
||||||
|
RESOLVEDIP="$IP"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < <(getent hosts "$HOST" | awk '{ print $1 }')
|
||||||
|
|
||||||
|
if [[ -z "$RESOLVEDIP" ]]; then
|
||||||
|
msg_error "DNS resolution failed or no valid IPv4/IPv6 address for $HOST"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
msg_ok "Resolved $HOST → ${BL}$RESOLVEDIP${CL}"
|
msg_ok "Resolved $HOST → ${BL}$RESOLVEDIP${CL}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user