Update install.func
This commit is contained in:
parent
b60fca3307
commit
4c2a3157ce
@ -126,24 +126,25 @@ network_check() {
|
||||
|
||||
# DNS resolution checks for GitHub-related domains (IPv4 and/or IPv6)
|
||||
GITHUB_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com")
|
||||
GITHUB_STATUS="GitHub DNS:"
|
||||
|
||||
for HOST in "${GITHUB_HOSTS[@]}"; do
|
||||
RESOLVEDIP=""
|
||||
while read -r IP; do
|
||||
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 }')
|
||||
|
||||
RESOLVEDIP=$(getent hosts "$HOST" | awk '{ print $1 }' | grep -E '(^([0-9]{1,3}\.){3}[0-9]{1,3}$)|(^[a-fA-F0-9:]+$)' | head -n1)
|
||||
if [[ -z "$RESOLVEDIP" ]]; then
|
||||
msg_error "DNS resolution failed or no valid IPv4/IPv6 address for $HOST - Check your DNS or Adblocker settings"
|
||||
exit 1
|
||||
GITHUB_STATUS+=" ❌ $HOST"
|
||||
DNS_FAILED=true
|
||||
else
|
||||
msg_ok "Resolved $HOST → ${BL}$RESOLVEDIP${CL}"
|
||||
GITHUB_STATUS+=" ✅ $HOST"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$DNS_FAILED" == true ]]; then
|
||||
msg_error "$GITHUB_STATUS"
|
||||
exit 1
|
||||
else
|
||||
msg_ok "$GITHUB_STATUS"
|
||||
fi
|
||||
|
||||
set -e
|
||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user