From 6e88277b0b9b45bb82c5c64e6c3b3f1682691443 Mon Sep 17 00:00:00 2001
From: Holger Paradies <retabell@gmx.de>
Date: Mon, 29 Mar 2021 18:40:39 +0200
Subject: Use deb.debian.org in final iso

It is possible to use any desired mirror for all task
and ends with deb.debian.org.
---
 config/chroot_local-hooks/00-sources.list         |  6 +++++-
 config/chroot_local-hooks/xx-sources.list         | 12 ++++++++++++
 config/chroot_local-includes/etc/apt/sources.list |  4 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100755 config/chroot_local-hooks/xx-sources.list

diff --git a/config/chroot_local-hooks/00-sources.list b/config/chroot_local-hooks/00-sources.list
index 880e38a..d81ce7c 100755
--- a/config/chroot_local-hooks/00-sources.list
+++ b/config/chroot_local-hooks/00-sources.list
@@ -1,6 +1,10 @@
 #!/bin/sh
 for file in /root/config/*; do [ -r $file ] && . $file; done
 
+echo "Info: mirror is ${LB_MIRROR_CHROOT} or ${LB_PARENT_MIRROR_CHROOT}"
+
+sed -i -e "s#@MIRRORDUMMY@#${LB_MIRROR_CHROOT}#"g /etc/apt/sources.list
+
 for x in /etc/apt/sources.list.d/*.list; do
    if grep -q '### THIS FILE IS AUTOMATICALLY CONFIGURED ###' $x; then
       rm -f $x
@@ -24,5 +28,5 @@ esac
 
 # fix for archive
 if [ "$LB_DISTRIBUTION" = "wheezy" ]; then
-   sed -i -e "s|ftp.de.debian.org/debian wheezy|archive.debian.org/debian wheezy|g" /etc/apt/sources.list
+   sed -i -e "s#${LB_MIRROR_CHROOT}#http://archive.debian.org/debian#g" /etc/apt/sources.list
 fi
diff --git a/config/chroot_local-hooks/xx-sources.list b/config/chroot_local-hooks/xx-sources.list
new file mode 100755
index 0000000..9ea083f
--- /dev/null
+++ b/config/chroot_local-hooks/xx-sources.list
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+for file in /root/config/*; do [ -r $file ] && . $file; done
+
+echo "Info: mirror is ${LB_MIRROR_CHROOT} or ${LB_PARENT_MIRROR_CHROOT}"
+
+# end up with deb.debian.org in final iso since stretch
+case "${LB_DISTRIBUTION}" in
+    wheezy|jessie) exit ;;
+esac
+
+sed -i -e "s#${LB_MIRROR_CHROOT}#http://deb.debian.org/debian#"g /etc/apt/sources.list
diff --git a/config/chroot_local-includes/etc/apt/sources.list b/config/chroot_local-includes/etc/apt/sources.list
index 3593810..8f05a89 100644
--- a/config/chroot_local-includes/etc/apt/sources.list
+++ b/config/chroot_local-includes/etc/apt/sources.list
@@ -3,8 +3,8 @@
 # CDROMs are managed through the apt-cdrom tool.
 
 # Debian @DISTRIBUTION@
-deb http://ftp.de.debian.org/debian @DISTRIBUTION@ main contrib non-free
-deb-src http://ftp.de.debian.org/debian @DISTRIBUTION@ main contrib non-free
+deb @MIRRORDUMMY@ @DISTRIBUTION@ main contrib non-free
+deb-src @MIRRORDUMMY@ @DISTRIBUTION@ main contrib non-free
 
 # Debian @DISTRIBUTION@ Updates
 deb http://security.debian.org @DISTRIBUTION@-security/updates main contrib non-free
-- 
cgit v1.0