Update install.func

update the script to include IPv6 connectivity considerations
This commit is contained in:
tteckster 2024-02-02 07:40:50 -05:00 committed by GitHub
parent 29e012d282
commit 72de387b5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 7 deletions

View File

@ -112,8 +112,12 @@ setting_up_container() {
network_check() { network_check() {
set +e set +e
trap - ERR trap - ERR
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else # Check if IPv4 is being used
msg_error "Internet NOT Connected" if ip -o -4 addr show | grep -q "scope global"; then
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
msg_ok "IPv4 Internet Connected";
else
msg_error "IPv4 Internet Not Connected";
read -r -p "Would you like to continue anyway? <y/N> " prompt read -r -p "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}"
@ -122,6 +126,24 @@ network_check() {
exit 1 exit 1
fi fi
fi fi
fi
# Check if IPv6 is being used
if ip -o -6 addr show | grep -q "scope global"; then
if ping6 -c 1 -W 1 2606:4700:4700::1111 &>/dev/null; then
msg_ok "IPv6 Internet Connected";
else
msg_error "IPv6 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
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
set -e set -e