Add network tools (#467)

This commit is contained in:
tteckster 2022-08-29 20:22:03 -04:00 committed by GitHub
parent b21ce7b82e
commit 77f299cb05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -37,6 +37,10 @@ function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
msg_info "Setting up Container OS " msg_info "Setting up Container OS "
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
@ -54,6 +58,10 @@ done
msg_ok "Set up Container OS" msg_ok "Set up Container OS"
msg_ok "Network Connected: ${BL}$(hostname -I)" msg_ok "Network Connected: ${BL}$(hostname -I)"
if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; fi;
RESOLVEDIP=$(nslookup "google.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved to $RESOLVEDIP"; fi;
msg_info "Updating Container OS" msg_info "Updating Container OS"
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null apt-get -y upgrade &>/dev/null

View File

@ -38,6 +38,11 @@ function msg_ok() {
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
msg_info "Setting up Container OS " msg_info "Setting up Container OS "
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
locale-gen >/dev/null locale-gen >/dev/null
@ -54,6 +59,10 @@ done
msg_ok "Set up Container OS" msg_ok "Set up Container OS"
msg_ok "Network Connected: ${BL}$(hostname -I)" msg_ok "Network Connected: ${BL}$(hostname -I)"
if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; fi;
RESOLVEDIP=$(nslookup "google.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved to $RESOLVEDIP"; fi;
msg_info "Updating Container OS" msg_info "Updating Container OS"
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null apt-get -y upgrade &>/dev/null