- Package:
- debootstrap
- Source:
- debootstrap
- Submitter:
- Marc Haber
- Date:
- 2023-12-21 01:09:05 UTC
- Severity:
- wishlist
- Tags:
Hi, using debootstrap with http_proxy set works fine. However, the resulting chroot is not configured to use the proxy, and subsequent attempts to use apt fail. Please think about possibilities to fix this, for example by generating a /etc/apt/apt.conf.d/proxy and/or /etc/bash.bashrc containing the appropriate settings learned from http_proxy in the host system. Greetings Marc
diff --git a/debootstrap b/debootstrap
index 8fbf954..d4dfea2 100755
--- a/debootstrap
+++ b/debootstrap
@@ -447,6 +447,19 @@ if ! doing_variant fakechroot && command -v apt-config >/dev/null; then
fi
fi
+###########################################################################
+# keep apt conf proxy settings in chroot #640992
+# export env for dldebs setup phase, and below during first_stage config apt
+APT_CONF_PROXY=""
+if ! doing_variant fakechroot && command -v apt-config >/dev/null; then
+ eval "$(apt-config shell APT_CONF_PROXY Acquire::http::Proxy)"
+ if [ -n "$APT_CONF_PROXY" ]; then
+ info APT_CONF_PROXY "Using apt conf proxy for setup: $APT_CONF_PROXY"
+ http_proxy="$APT_CONF_PROXY"
+ export http_proxy
+ fi
+fi
+
###########################################################################
if [ -n "$DISABLE_KEYRING" ] && [ -n "$FORCE_KEYRING" ]; then
error 1 BADARG "Both --no-check-gpg and --force-check-gpg specified, please pick one (at most)"
@@ -803,6 +816,12 @@ if am_doing_phase first_stage; then
else
setup_apt_sources "$DEF_MIRROR"
fi
+
+ # configure apt proxy settings within chroot if detected above #640992
+ if [ -n "$APT_CONF_PROXY" ]; then
+ info APT_CONF_PROXY "Configuring apt proxy: $APT_CONF_PROXY"
+ echo 'Acquire::http::Proxy "'$APT_CONF_PROXY'";' >> $TARGET/etc/apt/apt.conf.d/90proxy
+ fi
fi
if am_doing_phase second_stage; then
diff --git a/debootstrap b/debootstrap
index a29d289..9fdd736 100755
--- a/debootstrap
+++ b/debootstrap
@@ -470,6 +470,19 @@ if ! doing_variant fakechroot && command -v apt-config
fi
fi
+###########################################################################
+# keep apt conf proxy settings in chroot #640992
+# export env for dldebs setup phase, and below during first_stage config
apt
+APT_CONF_PROXY=""
+if ! doing_variant fakechroot && command -v apt-config >/dev/null; then
+ eval "$(apt-config shell APT_CONF_PROXY Acquire::http::Proxy)"
+ if [ -n "$APT_CONF_PROXY" ]; then
+ info APT_CONF_PROXY "Using apt conf proxy for setup: $APT_CONF_PROXY"
+ http_proxy="$APT_CONF_PROXY"
+ export http_proxy
+ fi
+fi
+
###########################################################################
if [ -n "$DISABLE_KEYRING" ] && [ -n "$FORCE_KEYRING" ]; then
error 1 BADARG "Both --no-check-gpg and --force-check-gpg specified,
please pick one (at most)"
@@ -829,6 +842,12 @@ if am_doing_phase first_stage; then
else
setup_apt_sources "$DEF_MIRROR"
fi
+
+ # configure apt proxy settings within chroot if detected above #640992
+ if [ -n "$APT_CONF_PROXY" ]; then
+ info APT_CONF_PROXY "Configuring apt proxy: $APT_CONF_PROXY"
+ echo 'Acquire::http::Proxy "'$APT_CONF_PROXY'";' >>
$TARGET/etc/apt/apt.conf.d/90proxy
+ fi
fi
if am_doing_phase second_stage; then