Update debian-install.sh

This commit is contained in:
tteckster 2022-05-05 05:52:51 -04:00 committed by GitHub
parent b85a683f43
commit 26bbfdee8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 33 deletions

View File

@ -28,37 +28,6 @@ function error_exit() {
exit $EXIT exit $EXIT
} }
function internet() {
test_urls="\
https://www.google.com/ \
https://www.microsoft.com/ \
https://www.cloudflare.com/ \
"
processes="0"
pids=""
for test_url in $test_urls; do
curl --silent --head "$test_url" > /dev/null &
pids="$pids $!"
processes=$(($processes + 1))
done
while [ $processes -gt 0 ]; do
for pid in $pids; do
if ! ps | grep "^[[:blank:]]*$pid[[:blank:]]" > /dev/null; then
processes=$(($processes - 1))
pids=$(echo "$pids" | sed --regexp-extended "s/(^| )$pid($| )/ /g")
if wait $pid; then
kill -TERM $pids > /dev/null 2>&1 || true
wait $pids
return 0
fi
fi
done
sleep 0.1
done
return 1
}
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..." echo -ne " ${HOLD} ${YW}${msg}..."
@ -85,10 +54,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 internet; then if : >/dev/tcp/8.8.8.8/53; then
msg_ok "Internet Online" msg_ok "Internet Online"
else else
echo -e "${BFR} {CROSS}${RD} Internet Offline" echo -e "${BFR} ${CROSS}${RD} Internet Offline"
fi fi
msg_info "Updating Container OS" msg_info "Updating Container OS"