diff options
author | Lyndon Brown <jnqnfe@gmail.com> | 2020-03-10 16:27:31 +0000 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2020-03-10 17:47:41 +0000 |
commit | e3da1b6f8dec5be364dd1d8b50aea7302f3ea720 (patch) | |
tree | 0f6527b232479a49b1b67fd35a665e211574972a /scripts/build/bootstrap_debootstrap | |
parent | d79fd1e760a582889ac3f3a90f9245a02e305276 (diff) | |
download | vyos-live-build-e3da1b6f8dec5be364dd1d8b50aea7302f3ea720.tar.gz vyos-live-build-e3da1b6f8dec5be364dd1d8b50aea7302f3ea720.zip |
debootstrap: remove redundant check
the check for existence of debootstrap here was completely redundant since
there is a check at the beginning of the file which already outputs an
appropriate error and exists if missing.
Diffstat (limited to 'scripts/build/bootstrap_debootstrap')
-rwxr-xr-x | scripts/build/bootstrap_debootstrap | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap index 89cfba363..c17ce2908 100755 --- a/scripts/build/bootstrap_debootstrap +++ b/scripts/build/bootstrap_debootstrap @@ -72,56 +72,50 @@ then DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --no-check-gpg" fi -if [ $(which debootstrap) ] +if [ "${LB_CACHE_PACKAGES}" = "true" ] then - if [ "${LB_CACHE_PACKAGES}" = "true" ] + if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 then - if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 - then - mkdir -p chroot/var/cache/apt/archives - cp cache/packages.bootstrap/*.deb chroot/var/cache/apt/archives - fi - - Echo_breakage "Running debootstrap (download-only)... " - 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 - - # Saving new cache - mkdir -p cache/packages.bootstrap - cp chroot/var/cache/apt/archives/*.deb cache/packages.bootstrap + mkdir -p chroot/var/cache/apt/archives + cp cache/packages.bootstrap/*.deb chroot/var/cache/apt/archives fi - Echo_breakage "Running debootstrap... " + Echo_breakage "Running debootstrap (download-only)... " + debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} - # Run appropriate bootstrap, i.e. foreign or regular bootstrap - if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then + # Removing old cache + rm -f cache/packages.bootstrap/*.deb - if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ] - then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" - fi + # Saving new cache + mkdir -p cache/packages.bootstrap + cp chroot/var/cache/apt/archives/*.deb cache/packages.bootstrap +fi - Echo_message "Bootstrap will be foreign" - debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} +Echo_breakage "Running debootstrap... " - 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}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} - fi +# Run appropriate bootstrap, i.e. foreign or regular bootstrap +if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then - # Deconfiguring debootstrap configurations - rm -f chroot/etc/hosts + if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ] + then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" + fi - # Removing bootstrap cache - rm -f chroot/var/cache/apt/archives/*.deb + Echo_message "Bootstrap will be foreign" + debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} - # Creating stage file - Create_stagefile .build/bootstrap + 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 - Echo_error "Can't find program debootstrap (FIXME)" - exit 1 + debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} fi + +# Deconfiguring debootstrap configurations +rm -f chroot/etc/hosts + +# Removing bootstrap cache +rm -f chroot/var/cache/apt/archives/*.deb + +# Creating stage file +Create_stagefile .build/bootstrap |