fix(network): deterministically restore qemu networking before src_get downloads

This commit is contained in:
vxtls 2026-03-04 16:14:59 -05:00
parent 0669db4e72
commit 893a320f6f
2 changed files with 30 additions and 0 deletions

View file

@ -277,6 +277,20 @@ randomize() {
fi fi
} }
ensure_network_ready() {
if [ "${NETWORK_READY}" = "True" ]; then
return
fi
# Resumed QEMU boots (e.g. from stage0-work.img) can lose configured links.
# Bring the interface up deterministically before any source download.
if [ "${QEMU}" = "True" ] && [ "${CHROOT}" != "True" ]; then
dhcpcd --waitip=4
fi
NETWORK_READY=True
}
download_source_line() { download_source_line() {
upstream_url="${1}" upstream_url="${1}"
checksum="${2}" checksum="${2}"
@ -330,6 +344,7 @@ source_line_action() {
# Default get function that downloads source tarballs. # Default get function that downloads source tarballs.
default_src_get() { default_src_get() {
ensure_network_ready
# shellcheck disable=SC2153 # shellcheck disable=SC2153
cd "${DISTFILES}" cd "${DISTFILES}"
# shellcheck disable=SC2162 # shellcheck disable=SC2162

View file

@ -277,6 +277,20 @@ randomize() {
fi fi
} }
ensure_network_ready() {
if [ "${NETWORK_READY}" = "True" ]; then
return
fi
# Resumed QEMU boots (e.g. from stage0-work.img) can lose configured links.
# Bring the interface up deterministically before any source download.
if [ "${QEMU}" = "True" ] && [ "${CHROOT}" != "True" ]; then
dhcpcd --waitip=4
fi
NETWORK_READY=True
}
download_source_line() { download_source_line() {
upstream_url="${1}" upstream_url="${1}"
checksum="${2}" checksum="${2}"
@ -330,6 +344,7 @@ source_line_action() {
# Default get function that downloads source tarballs. # Default get function that downloads source tarballs.
default_src_get() { default_src_get() {
ensure_network_ready
# shellcheck disable=SC2153 # shellcheck disable=SC2153
cd "${DISTFILES}" cd "${DISTFILES}"
# shellcheck disable=SC2162 # shellcheck disable=SC2162