Added 'retry' option to the install.func internet check

The function still allows the user to continue without internet or to abort the install, but this change adds a third option: retry internet connection. Before this change, I often ran into situations where I could quickly remedy my internet issue (eg firewall config on router) but then I would need to run the lxc install script again from the beginning.
pull/2412/head
rowanad 2 years ago committed by GitHub
parent 2a2dd14c9a
commit df7cafb4a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 41
      misc/install.func

@ -112,22 +112,51 @@ 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
while true; do
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then
msg_ok "Internet Connected"
break
else
msg_error "Internet NOT Connected" msg_error "Internet NOT Connected"
read -r -p "Would you like to continue anyway? <y/N> " prompt echo "Choose an option:"
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then echo "1) Continue without internet"
echo "2) Retest for internet connection"
echo "3) Abort"
read -r -p "Enter your choice (1/2/3): " choice
case $choice in
1)
echo -e " ⚠ ${RD}Expect Issues Without Internet${CL}" echo -e " ⚠ ${RD}Expect Issues Without Internet${CL}"
else break
;;
2)
echo "Retesting internet connection..."
continue
;;
3)
echo -e " 🖧 Check Network Settings" echo -e " 🖧 Check Network Settings"
exit 1 exit 1
;;
*)
echo "Invalid option. Please enter 1, 2, or 3."
;;
esac
fi fi
fi done
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
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
} }
# This function updates the Container OS by running apt-get update and upgrade # This function updates the Container OS by running apt-get update and upgrade
update_os() { update_os() {
msg_info "Updating Container OS" msg_info "Updating Container OS"

Loading…
Cancel
Save