Skip to content

Commit bd0f719

Browse files
committed
rootfs: route mmdebstrap through APT_PROXY_ADDR when set
mmdebstrap only used the apt cache via acng's URL-prefix, driven by MANAGE_ACNG; it ignored APT_PROXY_ADDR entirely. So on CI runners that export only APT_PROXY_ADDR (without MANAGE_ACNG), the base-system bootstrap downloaded direct from the mirror, uncached, while the later chroot apt-get phase (runners.sh) correctly went through the proxy. When APT_PROXY_ADDR is set and MANAGE_ACNG is no/unset, pass it to mmdebstrap as --aptopt='Acquire::http::Proxy "http://<addr>"' — the idiomatic proxy the existing FIXME hints at, and the same proxy the chroot phase uses. Treating it as a real proxy (not a URL-prefix) keeps it consistent with runners.sh and works for non-acng proxies too. The MANAGE_ACNG=yes / URL paths are untouched. Signed-off-by: Igor Pecovnik <igor@armbian.com>
1 parent 0d7d657 commit bd0f719

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/functions/rootfs/rootfs-create.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ function create_new_rootfs_cache_via_debootstrap() {
119119
debootstrap_arguments+=("--customize-hook='sync-out /var/cache/apt/archives/ ${LOCAL_APT_CACHE_INFO[HOST_DEBOOTSTRAP_CACHE_DIR]}'")
120120
fi
121121

122+
# If no managed acng is configured but an apt proxy address is set
123+
# (e.g. APT_PROXY_ADDR exported by a CI runner), route mmdebstrap's
124+
# downloads through it as a real proxy — the idiomatic --aptopt way the
125+
# MANAGE_ACNG case above hints at, and the same proxy the later chroot
126+
# apt-get phase uses (runners.sh). Without this the base-system bootstrap
127+
# goes direct to the mirror, bypassing the cache. MANAGE_ACNG=yes / a URL
128+
# already route through acng's URL-prefix, so this only covers no/unset.
129+
if [[ -n "${APT_PROXY_ADDR}" && ( "${MANAGE_ACNG}" == "no" || -z "${MANAGE_ACNG}" ) ]]; then
130+
display_alert "Routing mmdebstrap through apt proxy" "http://${APT_PROXY_ADDR##*@}" "info"
131+
debootstrap_arguments+=("'--aptopt=Acquire::http::Proxy \"http://${APT_PROXY_ADDR}\"'")
132+
fi
133+
122134
debootstrap_arguments+=("${RELEASE}" "${SDCARD}/" "${debootstrap_apt_mirror}") # release, path and mirror; always last, positional arguments.
123135

124136
mkdir -p "${SDCARD}/usr/bin"

0 commit comments

Comments
 (0)