Skip to content

Commit 3e504cf

Browse files
authored
final fixes
1 parent d2cbfcd commit 3e504cf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

misc/install.func

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)