mirror of
https://github.com/tteck/Proxmox.git
synced 2024-11-18 04:21:17 +00:00
Update debian-install.sh
This commit is contained in:
parent
ea5b2d9001
commit
b85a683f43
@ -28,6 +28,37 @@ function error_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() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
@ -54,6 +85,12 @@ done
|
||||
msg_ok "Set up Container OS"
|
||||
msg_ok "Network Connected: ${BL}$(hostname -I)"
|
||||
|
||||
if internet; then
|
||||
msg_ok "Internet Online"
|
||||
else
|
||||
echo -e "${BFR} {CROSS}${RD} Internet Offline"
|
||||
fi
|
||||
|
||||
msg_info "Updating Container OS"
|
||||
apt update &>/dev/null
|
||||
apt-get -qqy upgrade &>/dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user