Compare commits
3 Commits
e6acb092b3
...
89e5720cc2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
89e5720cc2 | ||
![]() |
4c2a3157ce | ||
![]() |
b60fca3307 |
@ -223,12 +223,13 @@ __curl_err_handler() {
|
||||
[[ -n "$curl_msg" ]] && printf "%s\n" "$curl_msg" >&2
|
||||
exit 1
|
||||
}
|
||||
detect_os_type() {
|
||||
if [[ -n "${var_os:-}" ]]; then
|
||||
CORE_OS="$var_os"
|
||||
else
|
||||
CORE_OS="debian"
|
||||
fi
|
||||
|
||||
detect_os() {
|
||||
case "$var_os" in
|
||||
alpine) CORE_OS="alpine" ;;
|
||||
debian | ubuntu) CORE_OS="debian" ;;
|
||||
*) CORE_OS="unknown" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
### dev spinner ###
|
||||
@ -240,7 +241,6 @@ spinner_frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
|
||||
# Ensure POSIX compatibility across Alpine and Debian/Ubuntu
|
||||
# === Spinner Start ===
|
||||
start_spinner() {
|
||||
detect_os_type
|
||||
local msg="$1"
|
||||
local spin_i=0
|
||||
local interval=0.1
|
||||
|
@ -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