Increase: Core Network check (pre-LXC Creation) (#6546)
* Update build.func * Update build.func * Update build.func
This commit is contained in:
parent
fc77ca85e4
commit
3dda41df94
@ -1282,36 +1282,42 @@ EOF
|
|||||||
if [ "$var_os" != "alpine" ]; then
|
if [ "$var_os" != "alpine" ]; then
|
||||||
msg_info "Waiting for network in LXC container"
|
msg_info "Waiting for network in LXC container"
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
|
# 1. Primary check: ICMP ping (fastest, but may be blocked by ISP/firewall)
|
||||||
if pct exec "$CTID" -- ping -c1 -W1 deb.debian.org >/dev/null 2>&1; then
|
if pct exec "$CTID" -- ping -c1 -W1 deb.debian.org >/dev/null 2>&1; then
|
||||||
msg_ok "Network in LXC is reachable"
|
msg_ok "Network in LXC is reachable (ping)"
|
||||||
break
|
|
||||||
fi
|
|
||||||
if pct exec "$CTID" -- curl -fsSIL --max-time 10 deb.debian.org >/dev/null 2>&1; then
|
|
||||||
msg_ok "Network in LXC is reachable"
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
# Wait and retry if not reachable yet
|
||||||
if [ "$i" -lt 10 ]; then
|
if [ "$i" -lt 10 ]; then
|
||||||
msg_warn "No network yet in LXC (try $i/10) – waiting..."
|
msg_warn "No network in LXC yet (try $i/10) – waiting..."
|
||||||
sleep 3
|
sleep 3
|
||||||
else
|
else
|
||||||
msg_error "No network in LXC after waiting."
|
# After 10 unsuccessful ping attempts, try HTTP connectivity via wget as fallback
|
||||||
read -r -p "Set fallback DNS (1.1.1.1/8.8.8.8)? [y/N]: " choice
|
msg_warn "Ping failed 10 times. Trying HTTP connectivity check (wget) as fallback..."
|
||||||
case "$choice" in
|
if pct exec "$CTID" -- wget -q --spider http://deb.debian.org; then
|
||||||
[yY]*)
|
msg_ok "Network in LXC is reachable (wget fallback)"
|
||||||
pct set "$CTID" --nameserver 1.1.1.1
|
else
|
||||||
pct set "$CTID" --nameserver 8.8.8.8
|
msg_error "No network in LXC after all checks."
|
||||||
if pct exec "$CTID" -- ping -c1 -W1 deb.debian.org >/dev/null 2>&1; then
|
read -r -p "Set fallback DNS (1.1.1.1/8.8.8.8)? [y/N]: " choice
|
||||||
msg_ok "Network reachable after DNS fallback"
|
case "$choice" in
|
||||||
else
|
[yY]*)
|
||||||
msg_error "Still no network/DNS in LXC! Aborting customization."
|
pct set "$CTID" --nameserver 1.1.1.1
|
||||||
exit 1
|
pct set "$CTID" --nameserver 8.8.8.8
|
||||||
fi
|
# Final attempt with wget after DNS change
|
||||||
;;
|
if pct exec "$CTID" -- wget -q --spider http://deb.debian.org; then
|
||||||
*)
|
msg_ok "Network reachable after DNS fallback"
|
||||||
msg_error "Aborted by user – no DNS fallback set."
|
else
|
||||||
exit 1
|
msg_error "Still no network/DNS in LXC! Aborting customization."
|
||||||
;;
|
exit_script
|
||||||
esac
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
msg_error "Aborted by user – no DNS fallback set."
|
||||||
|
exit_script
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -1346,7 +1352,7 @@ EOF'
|
|||||||
fi
|
fi
|
||||||
msg_ok "Customized LXC Container"
|
msg_ok "Customized LXC Container"
|
||||||
|
|
||||||
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/"$var_install".sh)" $?
|
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function sets the description of the container.
|
# This function sets the description of the container.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user