[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#888507: live-build: option to build against a distribution which is not the one enabled in the final image



Control: tag -1 + patch

On Fri, 26 Jan 2018, Raphaël Hertzog wrote:
> Much like we have --mirror-chroot and --mirror-binary, it would be nice to
> have --distribution-chroot and --distribution-binary so that we can build
> against a specific repository but have the final sources.list point to
> another repository.

I have implemented this for Kali and the attached patch works for me.
It still lacks some documentation update though.

It's not 100% transparent either, the LB_DISTRIBUTION_CHROOT is used
in the "dists" directory structure holding packages but in my tests
this codename is not used in the resulting installed systemd (and also not
in the live image). It might be possible to further improve this.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/
>From 05f3bd4b5ddea9bec36c78db7e0844f17fb41347 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hertzog@debian.org>
Date: Fri, 26 Jan 2018 17:15:08 +0100
Subject: [PATCH] Implement use of different distributions for build and
 runtime usage

---
 functions/defaults.sh                    | 20 ++++++++----
 functions/echo.sh                        |  2 +-
 scripts/build/binary_disk                | 10 +++---
 scripts/build/binary_package-lists       |  6 ++--
 scripts/build/binary_syslinux            |  4 +--
 scripts/build/bootstrap_archives         | 26 +++++++--------
 scripts/build/bootstrap_debootstrap      |  6 ++--
 scripts/build/build                      |  2 +-
 scripts/build/chroot_apt                 |  4 +--
 scripts/build/chroot_archives            | 52 +++++++++++++++---------------
 scripts/build/chroot_firmware            | 16 +++++-----
 scripts/build/config                     | 55 +++++++++++++++++++++++++++++---
 scripts/build/installer_debian-installer | 36 ++++++++-------------
 scripts/build/source_debian              |  6 ++--
 scripts/build/source_disk                |  4 +--
 15 files changed, 146 insertions(+), 103 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index 78ca358d1..a631d9703 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -128,18 +128,19 @@ Set_defaults ()
 			LB_DERIVATIVE="false"
 			;;
 	esac
+	LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION}}"
+	LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_CHROOT}}"
+
 
 	case "${LB_MODE}" in
 		progress-linux)
 			case "${LB_DISTRIBUTION}" in
 				baureo|baureo-backports)
 					LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-wheezy}"
-					LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
 					;;
 
 				cairon|cairon-backports)
 					LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-sid}"
-					LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
 					;;
 			esac
 
@@ -147,12 +148,17 @@ Set_defaults ()
 			;;
 
 		*)
-			LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION:-${LB_DISTRIBUTION}}"
-			LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION}}"
-
 			LB_BACKPORTS="${LB_BACKPORTS:-false}"
 			;;
 	esac
+	if [ -n "$LB_PARENT_DISTRIBUTION" ]; then
+		LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT:-${LB_PARENT_DISTRIBUTION}}"
+		LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY:-${LB_PARENT_DISTRIBUTION}}"
+	else
+		LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION_CHROOT}}"
+		LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_BINARY}}"
+	fi
+	LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION_CHROOT}}"
 
 	# Setting package manager
 	LB_APT="${LB_APT:-apt}"
@@ -479,7 +485,7 @@ Set_defaults ()
 	LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
 
 	# Setting security updates option
-	case "${LB_PARENT_DISTRIBUTION}" in
+	case "${LB_PARENT_DISTRIBUTION_BINARY}" in
 		sid)
 			LB_SECURITY="${LB_SECURITY:-false}"
 			;;
@@ -490,7 +496,7 @@ Set_defaults ()
 	esac
 
 	# Setting updates updates option
-	case "${LB_PARENT_DISTRIBUTION}" in
+	case "${LB_PARENT_DISTRIBUTION_BINARY}" in
 		sid)
 			LB_UPDATES="${LB_UPDATES:-false}"
 			;;
diff --git a/functions/echo.sh b/functions/echo.sh
index 96b742cef..40e76ea6e 100755
--- a/functions/echo.sh
+++ b/functions/echo.sh
@@ -193,7 +193,7 @@ Echo_file ()
 
 Echo_breakage ()
 {
-	case "${LB_PARENT_DISTRIBUTION}" in
+	case "${LB_PARENT_DISTRIBUTION_BINARY}" in
 		sid)
 			Echo_message "If the following stage fails, the most likely cause of the problem is with your mirror configuration, a caching proxy or the sid distribution."
 			;;
diff --git a/scripts/build/binary_disk b/scripts/build/binary_disk
index 7175a543a..d9fefa4b0 100755
--- a/scripts/build/binary_disk
+++ b/scripts/build/binary_disk
@@ -49,8 +49,8 @@ Create_lockfile .lock
 mkdir -p binary/.disk
 
 ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')"
-DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')"
-DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)"
+DISTRIBUTION="$(echo ${LB_DISTRIBUTION_BINARY} | cut -b 1 | tr '[a-z]' '[A-Z]')"
+DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION_BINARY} | cut -b 2-)"
 
 if [ -e chroot/etc/os-release ]
 then
@@ -111,7 +111,7 @@ case "${LB_DEBIAN_INSTALLER}" in
 		do
 			if [ -e "${LOCATION}" ]
 			then
-				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_udeb_include" binary/.disk/udeb_include
+				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES}_udeb_include" binary/.disk/udeb_include
 
 				continue
 			fi
@@ -136,7 +136,7 @@ case "${LB_DEBIAN_INSTALLER}" in
 		do
 			if [ -e "${LOCATION}" ]
 			then
-				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_netinst_udeb_include" binary/.disk/udeb_include
+				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES}_netinst_udeb_include" binary/.disk/udeb_include
 
 				continue
 			fi
@@ -159,7 +159,7 @@ case "${LB_DEBIAN_INSTALLER}" in
 		do
 			if [ -e "${LOCATION}" ]
 			then
-				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_businesscard_udeb_include" binary/.disk/udeb_include
+				cp "${LOCATION}/${LB_PARENT_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES}_businesscard_udeb_include" binary/.disk/udeb_include
 
 				continue
 			fi
diff --git a/scripts/build/binary_package-lists b/scripts/build/binary_package-lists
index a13491ee3..ca5a6f3e0 100755
--- a/scripts/build/binary_package-lists
+++ b/scripts/build/binary_package-lists
@@ -141,9 +141,9 @@ then
 
 		SECTION="$(basename ${SECTION})"
 
-		mkdir -p ${DISTS}/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}
-		apt-ftparchive packages ${POOL}/${SECTION} > ${DISTS}/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages
-		gzip -9 -c ${DISTS}/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages > ${DISTS}/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages.gz
+		mkdir -p ${DISTS}/${LB_PARENT_DISTRIBUTION_BINARY}/${SECTION}/binary-${LB_ARCHITECTURES}
+		apt-ftparchive packages ${POOL}/${SECTION} > ${DISTS}/${LB_PARENT_DISTRIBUTION_BINARY}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages
+		gzip -9 -c ${DISTS}/${LB_PARENT_DISTRIBUTION_BINARY}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages > ${DISTS}/${LB_PARENT_DISTRIBUTION_BINARY}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages.gz
 	done
 
 	cd "${OLDPWD}"
diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux
index bb6658826..df58f7d62 100755
--- a/scripts/build/binary_syslinux
+++ b/scripts/build/binary_syslinux
@@ -204,7 +204,7 @@ fi
 
 _VERSION="${_VERSION:-none}"
 
-_DISTRIBUTION="${LB_DISTRIBUTION}"
+_DISTRIBUTION="${LB_DISTRIBUTION_BINARY}"
 _ARCHITECTURE="${LB_ARCHITECTURES}"
 
 _DATE=$(date -R)
@@ -242,7 +242,7 @@ do
 			-e "s#@APPEND_INSTALL_FAILSAFE@#${LB_BOOTAPPEND_INSTALL_FAILSAFE}#g" \
 			-e "s|@PROJECT@|${_PROJECT}|g" \
 			-e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \
-			-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+			-e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION_BINARY}|g" \
 			-e "s|@VERSION@|${_VERSION}|g" \
 			-e "s|@ARCHITECTURE@|${_ARCHITECTURE}|g" \
 			-e "s|@DATE@|${_DATE}|g" \
diff --git a/scripts/build/bootstrap_archives b/scripts/build/bootstrap_archives
index f7bf7d8c4..cc0dd261f 100755
--- a/scripts/build/bootstrap_archives
+++ b/scripts/build/bootstrap_archives
@@ -65,19 +65,19 @@ then
 fi
 
 cat > chroot/etc/apt/${_PARENT_FILE} << EOF
-deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}
+deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT} ${LB_PARENT_ARCHIVE_AREAS}
 EOF
 
 if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 then
-	echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+	echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 fi
 
 if [ "${LB_DERIVATIVE}" = "true" ]
 then
 	rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
-	_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
+	_DISTRIBUTION="$(echo ${LB_DISTRIBUTION_CHROOT} | sed -e 's|-backports||')"
 
 	echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
@@ -91,17 +91,17 @@ if [ "${LB_SECURITY}" = "true" ]
 then
 	case "${LB_MODE}" in
 		debian|progress-linux)
-			case "${LB_PARENT_DISTRIBUTION}" in
+			case "${LB_PARENT_DISTRIBUTION_CHROOT}" in
 				sid)
 
 					;;
 
 				*)
-					echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+					echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION_CHROOT}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 					if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 					then
-						echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+						echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION_CHROOT}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 					fi
 					;;
 			esac
@@ -131,11 +131,11 @@ fi
 
 if [ "${LB_UPDATES}" = "true" ]
 then
-	echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+	echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 	if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 	then
-		echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+		echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 	fi
 
 	if [ "${LB_DERIVATIVE}" = "true" ]
@@ -153,13 +153,13 @@ if [ "${LB_BACKPORTS}" = "true" ]
 then
 	case "${LB_MODE}" in
 		debian)
-			if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
+			if [ "${LB_PARENT_DISTRIBUTION_CHROOT}" != "sid" ]
 			then
-				echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+				echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 				if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 				then
-					echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+					echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 				fi
 			fi
 			;;
@@ -181,8 +181,8 @@ for FILE in config/archives/*.list config/archives/*.list.chroot
 do
 	if [ -e "${FILE}" ]
 	then
-		sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
-		    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+		sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION_CHROOT}|g" \
+		    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION_CHROOT}|g" \
 		    -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
 		    -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
 		"${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap
index a89fc42a1..48a20fe19 100755
--- a/scripts/build/bootstrap_debootstrap
+++ b/scripts/build/bootstrap_debootstrap
@@ -88,7 +88,7 @@ then
 		fi
 
 		Echo_breakage "Running debootstrap (download-only)... "
-		debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
+		debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
 
 		# Removing old cache
 		rm -f cache/packages.bootstrap/*.deb
@@ -109,13 +109,13 @@ then
 		fi
 
 		Echo_message "Bootstrap will be foreign"
-		debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
+		debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
 
 		Echo_message "Running debootstrap second stage under QEMU"
 		cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin
 		Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage ${FOREIGN_DEBOOTSTRAP_OPTIONS}
 	else
-		debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
+		debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
 	fi
 
 	# Deconfiguring debootstrap configurations
diff --git a/scripts/build/build b/scripts/build/build
index c0f26b92d..ee90fb406 100755
--- a/scripts/build/build
+++ b/scripts/build/build
@@ -66,7 +66,7 @@ Set_defaults
 Check_defaults
 
 Echo_message "live-build ${LIVE_BUILD_VERSION}"
-Echo_message "Building config tree for a ${LB_MODE}/${LB_DISTRIBUTION}/${LB_ARCHITECTURES} system"
+Echo_message "Building config tree for a ${LB_MODE}/${LB_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES} system"
 
 # Bootstrapping system
 lb bootstrap ${@}
diff --git a/scripts/build/chroot_apt b/scripts/build/chroot_apt
index d48da7ec4..35094e056 100755
--- a/scripts/build/chroot_apt
+++ b/scripts/build/chroot_apt
@@ -150,7 +150,7 @@ case "${1}" in
 			progress-linux)
 				if [ ! -e chroot/etc/apt/preferences.d/progress-linux.pref ]
 				then
-					_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
+					_DISTRIBUTION="$(echo ${LB_DISTRIBUTION_BINARY} | sed -e 's|-backports||')"
 
 					_ENABLE_DISTRIBUTIONS="${_DISTRIBUTION}"
 					_DISABLE_DISTRIBUTIONS=""
@@ -165,7 +165,7 @@ case "${1}" in
 						_ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-updates"
 					fi
 
-					case "${LB_DISTRIBUTION}" in
+					case "${LB_DISTRIBUTION_BINARY}" in
 						*-backports)
 							if [ "${LB_BACKPORTS}" = "true" ]
 							then
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index 85ad35b0c..edc71575d 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -64,19 +64,19 @@ then
 fi
 
 cat > chroot/etc/apt/${_PARENT_FILE} << EOF
-deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}
+deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT} ${LB_PARENT_ARCHIVE_AREAS}
 EOF
 
 		if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 		then
-			echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+			echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 		fi
 
 		if [ "${LB_DERIVATIVE}" = "true" ]
 		then
 			rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
-			_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
+			_DISTRIBUTION="$(echo ${LB_DISTRIBUTION_CHROOT} | sed -e 's|-backports||')"
 
 			echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
@@ -90,17 +90,17 @@ EOF
 		then
 			case "${LB_MODE}" in
 				debian|progress-linux)
-					case "${LB_PARENT_DISTRIBUTION}" in
+					case "${LB_PARENT_DISTRIBUTION_CHROOT}" in
 						sid)
 
 							;;
 
 						*)
-							echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+							echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION_CHROOT}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 							if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 							then
-								echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+								echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION_CHROOT}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 							fi
 							;;
 					esac
@@ -130,11 +130,11 @@ EOF
 
 		if [ "${LB_UPDATES}" = "true" ]
 		then
-			echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+			echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 			if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 			then
-				echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+				echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 			fi
 
 			if [ "${LB_DERIVATIVE}" = "true" ]
@@ -152,13 +152,13 @@ EOF
 		then
 			case "${LB_MODE}" in
 				debian)
-					if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
+					if [ "${LB_PARENT_DISTRIBUTION_CHROOT}" != "sid" ]
 					then
-						echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+						echo "deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 						if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 						then
-							echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+							echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION_CHROOT}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 						fi
 					fi
 					;;
@@ -180,8 +180,8 @@ EOF
 		do
 			if [ -e "${FILE}" ]
 			then
-				sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
-				    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+				sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION_CHROOT}|g" \
+				    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION_CHROOT}|g" \
 				    -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
 				    -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
 				"${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)"
@@ -463,19 +463,19 @@ fi
 		# Configure custom sources.list
 
 cat > chroot/etc/apt/${_PARENT_FILE} << EOF
-deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}
+deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY} ${LB_PARENT_ARCHIVE_AREAS}
 EOF
 
 		if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 		then
-			echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+			echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 		fi
 
 		if [ "${LB_DERIVATIVE}" = "true" ]
 		then
 			rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
-			_DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')"
+			_DISTRIBUTION="$(echo ${LB_DISTRIBUTION_BINARY} | sed -e 's|-backports||')"
 
 			echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list
 
@@ -489,17 +489,17 @@ EOF
 		then
 			case "${LB_MODE}" in
 				debian|progress-linux)
-					case "${LB_PARENT_DISTRIBUTION}" in
+					case "${LB_PARENT_DISTRIBUTION_BINARY}" in
 						sid)
 
 							;;
 
 						*)
-							echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+							echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION_BINARY}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 							if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 							then
-								echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+								echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION_BINARY}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 							fi
 							;;
 					esac
@@ -529,11 +529,11 @@ EOF
 
 		if [ "${LB_UPDATES}" = "true" ]
 		then
-			echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+			echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 			if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 			then
-				echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+				echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 			fi
 
 			if [ "${LB_DERIVATIVE}" = "true" ]
@@ -551,13 +551,13 @@ EOF
 		then
 			case "${LB_MODE}" in
 				debian)
-					if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ]
+					if [ "${LB_PARENT_DISTRIBUTION_BINARY}" != "sid" ]
 					then
-						echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+						echo "deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 
 						if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
 						then
-							echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
+							echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION_BINARY}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
 						fi
 					fi
 					;;
@@ -606,8 +606,8 @@ EOF
 		do
 			if [ -e "${FILE}" ]
 			then
-				sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \
-				    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \
+				sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION_BINARY}|g" \
+				    -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION_BINARY}|g" \
 				    -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \
 				    -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \
 				"${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)"
diff --git a/scripts/build/chroot_firmware b/scripts/build/chroot_firmware
index ca208682b..8c89d561a 100755
--- a/scripts/build/chroot_firmware
+++ b/scripts/build/chroot_firmware
@@ -59,15 +59,15 @@ mkdir -p cache/contents.chroot
 
 FIRMWARE_PACKAGES=""
 
-_CONTENTS="$(for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS}; do echo ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
+_CONTENTS="$(for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS}; do echo ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION_CHROOT}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
 
-rm -f cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
+rm -f cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
 for _CONTENT in ${_CONTENTS}
 do
-	wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
+	wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
-	FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
+	FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES} | sort -u)"
 done
 
 if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free"
@@ -91,15 +91,15 @@ if [ "${LB_DERIVATIVE}" = "true" ]
 then
 	# FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents).
 
-	_CONTENTS="$(for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}; do echo ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
+	_CONTENTS="$(for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}; do echo ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION_CHROOT}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
 
-	rm -f cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
+	rm -f cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
 	for _CONTENT in ${_CONTENTS}
 	do
-		wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
+		wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
-		FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
+		FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES} | sort -u)"
 	done
 fi
 
diff --git a/scripts/build/config b/scripts/build/config
index c692a926f..9207e028b 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -57,6 +57,10 @@ USAGE="${PROGRAM}   [--apt apt|aptitude]\n\
 \t    [-d|--distribution CODENAME]\n\
 \t    [--parent-distribution CODENAME]\n\
 \t    [--parent-debian-installer-distribution CODENAME]\n\
+\t    [--distribution-chroot CODENAME]\n\
+\t    [--parent-distribution-chroot CODENAME]\n\
+\t    [--distribution-binary CODENAME]\n\
+\t    [--parent-distribution-binary CODENAME]\n\
 \t    [--dump]\n\
 \t    [--fdisk fdisk|fdisk.dist]\n\
 \t    [--force]\n\
@@ -133,7 +137,10 @@ Local_arguments ()
 		cache-stages:,debconf-frontend:,debconf-priority:,dump,
 		initramfs:,initramfs-compression:,initsystem:,fdisk:,losetup:,mode:,system:,tasksel:,
 		architectures:,clean,
-		distribution:,parent-distribution:,parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-binary:,
+		distribution:,parent-distribution:,parent-debian-installer-distribution:,
+		distribution-chroot:,parent-distribution-chroot:,
+		distribution-binary:,parent-distribution-binary:,
+		parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-binary:,
 		parent-mirror-binary-security:,parent-mirror-debian-installer:,
 		mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:,
 		mirror-binary-security:,mirror-debian-installer:,
@@ -352,6 +359,26 @@ Local_arguments ()
 				shift 2
 				;;
 
+			--distribution-chroot)
+				LB_DISTRIBUTION_CHROOT="${2}"
+				shift 2
+				;;
+
+			--parent-distribution-chroot)
+				LB_PARENT_DISTRIBUTION_CHROOT="${2}"
+				shift 2
+				;;
+
+			--distribution-binary)
+				LB_DISTRIBUTION_BINARY="${2}"
+				shift 2
+				;;
+
+			--parent-distribution-binary)
+				LB_PARENT_DISTRIBUTION_BINARY="${2}"
+				shift 2
+				;;
+
 			-m|--parent-mirror-bootstrap)
 				LB_PARENT_MIRROR_BOOTSTRAP="${2}"
 				shift 2
@@ -879,10 +906,10 @@ Check_defaults
 
 if [ ! -e config ]
 then
-	Echo_message "Creating config tree for a ${LB_MODE}/${LB_DISTRIBUTION}/${LB_ARCHITECTURES} system"
+	Echo_message "Creating config tree for a ${LB_MODE}/${LB_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES} system"
 	mkdir config
 else
-	Echo_message "Updating config tree for a ${LB_MODE}/${LB_DISTRIBUTION}/${LB_ARCHITECTURES} system"
+	Echo_message "Updating config tree for a ${LB_MODE}/${LB_DISTRIBUTION_BINARY}/${LB_ARCHITECTURES} system"
 fi
 
 # Creating live-build configuration
@@ -1020,6 +1047,22 @@ LB_DISTRIBUTION="${LB_DISTRIBUTION}"
 # (Default: ${LB_PARENT_DISTRIBUTION})
 LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION}"
 
+# \$LB_DISTRIBUTION_CHROOT: select distribution to use in the chroot
+# (Default: ${LB_DISTRIBUTION_CHROOT})
+LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT}"
+
+# \$LB_PARENT_DISTRIBUTION_CHROOT: select parent distribution to use in the chroot
+# (Default: ${LB_PARENT_DISTRIBUTION_CHROOT})
+LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT}"
+
+# \$LB_DISTRIBUTION_BINARY: select distribution to use in the final image
+# (Default: ${LB_DISTRIBUTION_BINARY})
+LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY}"
+
+# \$LB_PARENT_DISTRIBUTION_BINARY: select parent distribution to use in the final image
+# (Default: ${LB_PARENT_DISTRIBUTION_BINARY})
+LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY}"
+
 # \$LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION: select parent distribution for debian-installer to use
 # (Default: ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION})
 LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"
@@ -1386,7 +1429,8 @@ cat > config/build << EOF
 [Image]
 Architecture: ${LB_ARCHITECTURES}
 Archive-Areas: ${LB_ARCHIVE_AREAS}
-Distribution: ${LB_DISTRIBUTION}
+Distribution-Chroot: ${LB_DISTRIBUTION_CHROOT}
+Distribution-Binary: ${LB_DISTRIBUTION_BINARY}
 Mirror-Bootstrap: ${LB_MIRROR_BOOTSTRAP}
 EOF
 
@@ -1396,7 +1440,8 @@ then
 cat >> config/build << EOF
 
 Parent-Archive-Areas: ${LB_ARCHIVE_AREAS}
-Parent-Distribution: ${LB_PARENT_DISTRIBUTION}
+Parent-Distribution-Chroot: ${LB_PARENT_DISTRIBUTION_CHROOT}
+Parent-Distribution-Binary: ${LB_PARENT_DISTRIBUTION_BINARY}
 Parent-Mirror-Bootstrap: ${LB_PARENT_MIRROR_BOOTSTRAP}
 EOF
 
diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer
index ec931fa68..32390d334 100755
--- a/scripts/build/installer_debian-installer
+++ b/scripts/build/installer_debian-installer
@@ -349,15 +349,15 @@ then
 
 		FIRMWARE_PACKAGES=""
 
-		_CONTENTS="$(for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS}; do echo ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
+		_CONTENTS="$(for _PARENT_ARCHIVE_AREA in ${LB_PARENT_ARCHIVE_AREAS}; do echo ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION_CHROOT}/${_PARENT_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
 
-		rm -f cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
+		rm -f cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
 		for _CONTENT in ${_CONTENTS}
 		do
-			wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES}
+			wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
-			FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
+			FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES} | sort -u)"
 		done
 
 		if echo ${LB_PARENT_ARCHIVE_AREAS} | grep -qs "non-free"
@@ -381,15 +381,15 @@ then
 		then
 			# FIXME: account for the fact that PARENT_DISTRIBUTION and DISTRIBUTION might be the same (to not have overlapping cache files for contents).
 
-			_CONTENTS="$(for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}; do echo ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
+			_CONTENTS="$(for _ARCHIVE_AREA in ${LB_ARCHIVE_AREAS}; do echo ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION_CHROOT}/${_ARCHIVE_AREA}/Contents-${LB_ARCHITECTURES}.gz; done)"
 
-			rm -f cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
+			rm -f cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
 			for _CONTENT in ${_CONTENTS}
 			do
-				wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES}
+				wget ${WGET_OPTIONS} ${_CONTENT} -O - | gunzip -c >> cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES}
 
-				FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)"
+				FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION_CHROOT}.${LB_ARCHITECTURES} | sort -u)"
 			done
 		fi
 
@@ -672,13 +672,13 @@ then
 		_LB_APT_VERSION_OPT='-o APT::FTPArchive::Release::Version="'"${_VERSION}"'"'
 	fi
 
-	case "${LB_PARENT_DISTRIBUTION}" in
+	case "${LB_PARENT_DISTRIBUTION_BINARY}" in
 		sid)
 			_SUITE="unstable"
 			;;
 
 		*)
-			_SUITE="${LB_PARENT_DISTRIBUTION}"
+			_SUITE="${LB_PARENT_DISTRIBUTION_BINARY}"
 			;;
 	esac
 
@@ -688,7 +688,7 @@ cd /root/binary && apt-ftparchive \
 	-o APT::FTPArchive::Release::Label="Debian" \
 	-o APT::FTPArchive::Release::Suite="${_SUITE}" \
 	${_LB_APT_VERSION_OPT} \
-	-o APT::FTPArchive::Release::Codename="${LB_PARENT_DISTRIBUTION}" \
+	-o APT::FTPArchive::Release::Codename="${LB_PARENT_DISTRIBUTION_BINARY}" \
 	-o APT::FTPArchive::Release::Date="$(date -R)" \
 	-o APT::FTPArchive::Release::Architectures="${LB_ARCHITECTURES}" \
 	-o APT::FTPArchive::Release::Components="${LB_PARENT_ARCHIVE_AREAS}" \
@@ -700,19 +700,11 @@ EOF
 	rm -f chroot/binary.sh
 	mv chroot/root/binary ./
 
-	case "${LB_PARENT_DISTRIBUTION}" in
-		jessie)
-			DISTRIBUTIONS="stable"
-			;;
-
-		*)
-			DISTRIBUTIONS="stable testing unstable"
-			;;
-	esac
+	DISTRIBUTIONS="stable testing unstable"
 
-	if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" != "${LB_PARENT_DISTRIBUTION}" ]
+	if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" != "${LB_PARENT_DISTRIBUTION_BINARY}" ]
 	then
-		DISTRIBUTIONS="${DISTRIBUTIONS} ${LB_PARENT_DISTRIBUTION}"
+		DISTRIBUTIONS="${DISTRIBUTIONS} ${LB_PARENT_DISTRIBUTION_BINARY}"
 	fi
 
 	case "${LIVE_IMAGE_TYPE}" in
diff --git a/scripts/build/source_debian b/scripts/build/source_debian
index 321ed1b4a..3960ea2a8 100755
--- a/scripts/build/source_debian
+++ b/scripts/build/source_debian
@@ -117,19 +117,19 @@ fi
 # where available. workaround: disable backports
 case "${LB_MODE}" in
 	progress-linux)
-		case "${LB_DISTRIBUTION}" in
+		case "${LB_DISTRIBUTION_BINARY}" in
 			*-backports)
 
 				;;
 
 			*)
-				if grep -qs "${LB_DISTRIBUTION}-backports" chroot/etc/apt/sources.list.d/progress-linux.list
+				if grep -qs "${LB_DISTRIBUTION_BINARY}-backports" chroot/etc/apt/sources.list.d/progress-linux.list
 				then
 					cp chroot/etc/apt/sources.list.d/progress-linux.list chroot/etc/apt/sources.list.d/progress-linux.list.orig
 
 					while read _LINE
 					do
-						if echo "${_LINE}" | grep -qs ${LB_DISTRIBUTION}-backports
+						if echo "${_LINE}" | grep -qs ${LB_DISTRIBUTION_BINARY}-backports
 						then
 							sed -i -e "s|${_LINE}|#${_LINE}|" chroot/etc/apt/sources.list.d/progress-linux.list
 						fi
diff --git a/scripts/build/source_disk b/scripts/build/source_disk
index eaaf7d2dd..291a40357 100755
--- a/scripts/build/source_disk
+++ b/scripts/build/source_disk
@@ -49,8 +49,8 @@ Create_lockfile .lock
 
 mkdir -p source/.disk
 
-DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')"
-DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)"
+DISTRIBUTION="$(echo ${LB_DISTRIBUTION_BINARY} | cut -b 1 | tr '[a-z]' '[A-Z]')"
+DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION_BINARY} | cut -b 2-)"
 
 if [ -e chroot/etc/os-release ]
 then
-- 
2.15.1


Reply to: