File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,30 @@ network_check() {
101101 exit 1
102102 fi
103103 fi
104+
105+ # DNS resolution checks for GitHub-related domains (IPv4 and/or IPv6)
106+ GIT_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com" "git.community-scripts.org")
107+ GIT_STATUS="Git DNS:"
108+ DNS_FAILED=false
109+
110+ for HOST in "${GIT_HOSTS[@]}"; do
111+ RESOLVEDIP=$(getent hosts "$HOST" | awk '{ print $1 }' | grep -E '(^([0-9]{1,3}\.){3}[0-9]{1,3}$)|(^[a-fA-F0-9:]+$)' | head -n1)
112+ if [[ -z "$RESOLVEDIP" ]]; then
113+ GIT_STATUS+="$HOST:($DNSFAIL)"
114+ DNS_FAILED=true
115+ else
116+ GIT_STATUS+=" $HOST:($DNSOK)"
117+ fi
118+ done
119+
120+ if [[ "$DNS_FAILED" == true ]]; then
121+ fatal "$GIT_STATUS"
122+ else
123+ msg_ok "$GIT_STATUS"
124+ fi
125+
126+ set -e
127+ trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
104128}
105129
106130# This function updates the Container OS by running apt-get update and upgrade
You can’t perform that action at this time.
0 commit comments