Update install.func
This commit is contained in:
parent
c7ba6705aa
commit
ae4fcc9546
@ -96,6 +96,7 @@ network_check() {
|
||||
ipv4_connected=false
|
||||
ipv6_connected=false
|
||||
sleep 1
|
||||
|
||||
# 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
|
||||
msg_ok "IPv4 Internet Connected"
|
||||
@ -114,7 +115,7 @@ network_check() {
|
||||
|
||||
# If both IPv4 and IPv6 checks fail, prompt the user
|
||||
if [[ $ipv4_connected == false && $ipv6_connected == false ]]; then
|
||||
read -r -p "No Internet detected,would you like to continue anyway? <y/N> " prompt
|
||||
read -r -p "No Internet detected, would you like to continue anyway? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
echo -e "${INFO}${RD}Expect Issues Without Internet${CL}"
|
||||
else
|
||||
@ -123,12 +124,20 @@ network_check() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# DNS resolution checks for GitHub-related domains (IPv4 and/or IPv6)
|
||||
GITHUB_HOSTS=("github.com" "raw.githubusercontent.com" "api.github.com")
|
||||
|
||||
for HOST in "${GITHUB_HOSTS[@]}"; do
|
||||
RESOLVEDIP=$(getent hosts "$HOST" | awk '{ print $1 }')
|
||||
if [[ -z "$RESOLVEDIP" || (! "$RESOLVEDIP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ && ! "$RESOLVEDIP" =~ ^([a-fA-F0-9:]+)$) ]]; then
|
||||
msg_error "DNS resolution failed or invalid IP for $HOST"
|
||||
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 }')
|
||||
|
||||
if [[ -z "$RESOLVEDIP" ]]; then
|
||||
msg_error "DNS resolution failed or no valid IPv4/IPv6 address for $HOST"
|
||||
exit 1
|
||||
else
|
||||
msg_ok "Resolved $HOST → ${BL}$RESOLVEDIP${CL}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user