summaryrefslogtreecommitdiff
path: root/scripts/build/bootstrap_debootstrap
diff options
context:
space:
mode:
authorRaphaël Hertzog <raphael@offensive-security.com>2019-12-19 18:18:44 +0100
committerRaphaël Hertzog <raphael@offensive-security.com>2019-12-19 18:18:44 +0100
commit44b9b0a6501476de594ce3783cea5df0c141478c (patch)
treedd84f8ea71c77fc5774a736db95f7669e1e58c2b /scripts/build/bootstrap_debootstrap
parente7221c02f3baae0eaeb804b573551ad883d95290 (diff)
downloadvyos-live-build-44b9b0a6501476de594ce3783cea5df0c141478c.tar.gz
vyos-live-build-44b9b0a6501476de594ce3783cea5df0c141478c.zip
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
Diffstat (limited to 'scripts/build/bootstrap_debootstrap')
-rwxr-xr-xscripts/build/bootstrap_debootstrap13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap
index 99f0a22e5..48a20fe19 100755
--- a/scripts/build/bootstrap_debootstrap
+++ b/scripts/build/bootstrap_debootstrap
@@ -62,6 +62,7 @@ if [ "${LB_ARCHIVE_AREAS}" != "main" ]
then
# Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')"
+ FOREIGN_DEBOOTSTRAP_OPTIONS="--components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')"
fi
if [ "${_VERBOSE}" = "true" ]
@@ -87,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
@@ -107,10 +108,14 @@ then
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')"
fi
- Echo_message "Running debootstrap with qemu-debootstrap"
- qemu-debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
+ Echo_message "Bootstrap will be foreign"
+ 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