Fix clear and network check for curl pipe execution

- Guard `clear` with terminal check so it doesn't fail when TERM is
  unset (common in curl pipe context)
- Use curl instead of ping for network check (ICMP often blocked in LXC)
- Fix ((tries++)) from 0 evaluating as falsy under set -e

https://claude.ai/code/session_013gJJD3cxafQSVmyn9pXcdn
This commit is contained in:
Claude 2026-02-15 05:40:47 +00:00
parent 039a441a5d
commit 286a97d68c
No known key found for this signature in database

View file

@ -148,7 +148,7 @@ get_ip() {
# -- Header --------------------------------------------------------------------
header_info() {
clear
[[ -t 1 ]] && clear 2>/dev/null || true
echo ""
cat <<"BANNER"
____ _ ____
@ -199,14 +199,14 @@ arch_check() {
network_check() {
msg_info "Checking network connectivity"
local tries=0
while ! ping -c 1 -W 3 github.com &>/dev/null; do
((tries++))
local tries=1
while ! curl -fsSL --max-time 5 https://github.com >/dev/null 2>&1; do
if [[ $tries -ge 3 ]]; then
msg_error "No network connectivity (cannot reach github.com)"
echo -e "${TAB}${DIM}Ensure your LXC has a working network configuration.${CL}" >&2
exit 1
fi
((tries++)) || true
sleep 2
done
msg_ok "Network connectivity verified"