Update install.func

The script now checks for both IPv4 and IPv6 Internet connectivity and displays the results. Only if both IPv4 and IPv6 checks fail, it will then prompt the user.
This commit is contained in:
tteckster 2024-02-21 12:19:48 -05:00 committed by GitHub
parent c0e3edc0c9
commit 71ca43c7a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 26 deletions

View File

@ -112,29 +112,28 @@ setting_up_container() {
network_check() { network_check() {
set +e set +e
trap - ERR trap - ERR
# Check if IPv4 is being used ipv4_connected=false
if ip -o -4 addr show | grep -q "scope global"; then ipv6_connected=false
# Check IPv4 connectivity
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
msg_ok "IPv4 Internet Connected"; msg_ok "IPv4 Internet Connected";
ipv4_connected=true
else else
msg_error "IPv4 Internet Not Connected"; msg_error "IPv4 Internet Not Connected";
read -r -p "Would you like to continue anyway? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
echo -e " ⚠️ ${RD}Expect Issues Without Internet${CL}"
else
echo -e " 🖧 Check Network Settings"
exit 1
fi
fi
fi fi
# Check if IPv6 is being used # Check IPv6 connectivity
if ip -o -6 addr show | grep -q "scope global"; then if ping6 -c 1 -W 1 2606:4700:4700::1111 &>/dev/null; then
if ping -6 google.com &>/dev/null; then
msg_ok "IPv6 Internet Connected"; msg_ok "IPv6 Internet Connected";
ipv6_connected=true
else else
msg_error "IPv6 Internet Not Connected"; msg_error "IPv6 Internet Not Connected";
read -r -p "Would you like to continue anyway? <y/N> " prompt fi
# 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
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
echo -e " ⚠️ ${RD}Expect Issues Without Internet${CL}" echo -e " ⚠️ ${RD}Expect Issues Without Internet${CL}"
else else
@ -142,7 +141,6 @@ network_check() {
exit 1 exit 1
fi fi
fi fi
fi
RESOLVEDIP=$(getent hosts github.com | awk '{ print $1 }') RESOLVEDIP=$(getent hosts github.com | awk '{ print $1 }')
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to ${BL}$RESOLVEDIP${CL}"; fi if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to ${BL}$RESOLVEDIP${CL}"; fi