From 44b9b0a6501476de594ce3783cea5df0c141478c Mon Sep 17 00:00:00 2001 From: Raphaƫl Hertzog Date: Thu, 19 Dec 2019 18:18:44 +0100 Subject: Support --distribution-binary and --distribution-chroot This makes it possible to build an image against a first distribution (--distribution-chroot) and have the resulting image point to another distribution (--distribution-binary). We can use this to build against a snapshot and have the result use the original distribution that was snapshotted. Closes: #888507 --- functions/defaults.sh | 20 +++++++++++++------- functions/echo.sh | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'functions') diff --git a/functions/defaults.sh b/functions/defaults.sh index 1960d9c0a..a23424f92 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}" @@ -487,7 +493,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}" ;; @@ -498,7 +504,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." ;; -- cgit v1.2.3