From d17d1d82349f7f4cb60574f7d9c2f786eec3cc93 Mon Sep 17 00:00:00 2001
From: Luke Shumaker <LukeShu@sbcglobal.net>
Date: Thu, 20 Mar 2014 17:16:36 -0400
Subject: Fix issue #487; obey proxy settings when creating a chroot.

https://labs.parabola.nu/issues/487
---
 src/chroot-tools/Makefile         |  5 -----
 src/chroot-tools/mkarchroot.patch | 23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 5 deletions(-)
 create mode 100644 src/chroot-tools/mkarchroot.patch

(limited to 'src')

diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile
index c49c4ac..e44ad5f 100644
--- a/src/chroot-tools/Makefile
+++ b/src/chroot-tools/Makefile
@@ -15,9 +15,4 @@ include ../../common.mk
 makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in
 	cp $< $@
 
-mkarchroot: mkarchroot.in Makefile
-	@echo '< $< M4_EDIT | SED > $@'
-	@<'$<' $(edit) | sed -e 's|arch-nspawn|$$(librelib chroot/&)|' -e 's/pacstrap/env -i &/' >'$@'
-	@echo 'CHMOD $<'; chmod 755 "$@"
-
 distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage
diff --git a/src/chroot-tools/mkarchroot.patch b/src/chroot-tools/mkarchroot.patch
new file mode 100644
index 0000000..a0ea0f0
--- /dev/null
+++ b/src/chroot-tools/mkarchroot.patch
@@ -0,0 +1,23 @@
+--- mkarchroot.in	2014-01-05 18:51:15.231500986 -0500
++++ mkarchroot	2014-03-20 15:05:06.885086610 -0400
+@@ -65,6 +65,11 @@
+ 	chmod 0755 "$working_dir"
+ fi
+ 
++_env=()
++while read -r varname; do
++	_env+=("$varname=${!varname}")
++done < { declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$'; }
++env -i "${_env[@]}" \
+ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
+   "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
+ 
+@@ -72,7 +77,7 @@
+ echo 'LANG=C' > "$working_dir/etc/locale.conf"
+ echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
+ 
+-exec arch-nspawn \
++exec $(librelib chroot/arch-nspawn) \
+ 	${pac_conf:+-C "$pac_conf"} \
+ 	${makepkg_conf:+-M "$makepkg_conf"} \
+ 	${cache_dir:+-c "$cache_dir"} \
-- 
cgit v1.2.3-2-g168b