From 858988e80131d107ec4d4043961fdc3ed22c67c3 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Sun, 25 Aug 2024 03:17:25 +0200 Subject: [PATCH] trisquel-automatic-netinstall-qemu: make mirror/http/proxy configurable. Signed-off-by: Denis 'GNUtoo' Carikli --- trisquel-automatic-netinstall-qemu/.gitignore | 1 + .../Makefile.am | 4 ++++ .../configure.ac | 19 +++++++++++++++++++ .../{preseed.cfg => preseed.cfg.tmpl} | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) rename trisquel-automatic-netinstall-qemu/{preseed.cfg => preseed.cfg.tmpl} (97%) diff --git a/trisquel-automatic-netinstall-qemu/.gitignore b/trisquel-automatic-netinstall-qemu/.gitignore index 720569e..0deb0f6 100644 --- a/trisquel-automatic-netinstall-qemu/.gitignore +++ b/trisquel-automatic-netinstall-qemu/.gitignore @@ -14,6 +14,7 @@ /grub/** /grub.iso /Makefile +/preseed.cfg /preseed.img /rootfs.img /rootfs.img.tmp diff --git a/trisquel-automatic-netinstall-qemu/Makefile.am b/trisquel-automatic-netinstall-qemu/Makefile.am index c261f4a..3303d7f 100644 --- a/trisquel-automatic-netinstall-qemu/Makefile.am +++ b/trisquel-automatic-netinstall-qemu/Makefile.am @@ -54,6 +54,10 @@ grub/boot/grub/grub.cfg: Makefile grub.cfg grub.iso: Makefile grub/boot/linux grub/boot/initrd.gz grub/boot/grub/grub.cfg grub-mkrescue -o $@ grub +preseed.cfg: preseed.cfg.tmpl + sed 's#\@MIRROR_HTTP_PROXY\@#$(MIRROR_HTTP_PROXY)#g' \ + preseed.cfg.tmpl > $@ + preseed.img: Makefile preseed.cfg dd if=/dev/zero of=$@.tmp count=2048 mkfs.vfat --mbr=y -n MEDIA $@.tmp diff --git a/trisquel-automatic-netinstall-qemu/configure.ac b/trisquel-automatic-netinstall-qemu/configure.ac index f5d792a..43f31ea 100644 --- a/trisquel-automatic-netinstall-qemu/configure.ac +++ b/trisquel-automatic-netinstall-qemu/configure.ac @@ -22,6 +22,7 @@ AC_PROG_MKDIR_P AM_INIT_AUTOMAKE([foreign]) AC_SUBST([ENABLE_KVM], []) +AC_SUBST([MIRROR_HTTP_PROXY], []) AC_SUBST([TRISQUEL_ROOTFS_SIZE], []) AC_SUBST([TRISQUEL_NETINSTALL], []) @@ -33,6 +34,21 @@ AC_ARG_ENABLE(kvm, AM_CONDITIONAL( [WANT_KVM], [test x"$kvm" = x"yes"]) +AC_ARG_WITH( + [mirror-http-proxy], + [AS_HELP_STRING( + [--with-mirror-http-proxy=URL], + [URL to the mirror HTTP proxy (default: not set (no mirror)). + The proxy configuration is then used during both the netinstall + installation and after as well (it's added to /etc/apt/apt.conf). + The chosen URL should be reachable from QEMU. As an example, if + you use the apt-cacher-ng default configuration and make it + listen on localhost, you should use http://10.0.2.2:3142 because + localhost becomes 10.0.2.2 with the current QEMU configuration + and because the port 3142 is the default port for apt-cacher-ng.])], + [MIRROR_HTTP_PROXY=$withval], + [MIRROR_HTTP_PROXY=]) + AC_ARG_WITH( [--with-trisquel-target-rootfs-size], [AS_HELP_STRING( @@ -130,3 +146,6 @@ AS_IF([test x"$kvm" = x"yes"], [echo "- Kvm: disabled"]) echo "- Trisquel netinstall path: $TRISQUEL_NETINSTALL" echo "- Trisquel target rootfs size: $TRISQUEL_ROOTFS_SIZE" +AS_IF([test x"$MIRROR_HTTP_PROXY" = x""], + [echo "- Trisquel mirror http proxy: disabled"], + [echo "- Trisquel mirror http proxy: $MIRROR_HTTP_PROXY"]) diff --git a/trisquel-automatic-netinstall-qemu/preseed.cfg b/trisquel-automatic-netinstall-qemu/preseed.cfg.tmpl similarity index 97% rename from trisquel-automatic-netinstall-qemu/preseed.cfg rename to trisquel-automatic-netinstall-qemu/preseed.cfg.tmpl index 31a8c33..fe13cc2 100644 --- a/trisquel-automatic-netinstall-qemu/preseed.cfg +++ b/trisquel-automatic-netinstall-qemu/preseed.cfg.tmpl @@ -34,7 +34,7 @@ d-i netcfg/get_hostname string test d-i mirror/country string manual d-i mirror/http/directory string /trisquel d-i mirror/http/hostname string mirror.fsf.org -d-i mirror/http/proxy string +d-i mirror/http/proxy string @MIRROR_HTTP_PROXY@ popularity-contest popularity-contest/participate boolean false # Partitioning