debootstrap: Optionally use 'eatmydata'

If 'eatmydata' is found, use it.
On a CI system calling 'sync' influences the other processes that are
running on the shared host. 'debootstrap' calls 'sync' in its second
stage. For live-build, the synchronisation is not required.
This commit is contained in:
Roland Clobus 2025-01-10 11:51:25 +01:00
parent ddf289332c
commit d5bd2259be
No known key found for this signature in database
GPG Key ID: 62C57C6AA61495BD
2 changed files with 11 additions and 1 deletions

1
debian/control vendored
View File

@ -35,6 +35,7 @@ Recommends:
xz-utils,
Suggests:
e2fsprogs,
eatmydata,
git,
parted,
mtd-utils,

View File

@ -30,6 +30,15 @@ fi
Echo_message "Begin bootstrapping system..."
Check_package host /usr/sbin/debootstrap debootstrap
Check_installed host /usr/bin/eatmydata eatmydata
if [ "${INSTALL_STATUS}" -eq 0 ]
then
Echo_message "eatmydata found. It will be used do disable the sync command in the second stage of debootstrap"
_EATMYDATA="eatmydata"
else
# eatmydata is optional
_EATMYDATA=""
fi
# Checking stage file
Check_stagefile "bootstrap"
@ -110,7 +119,7 @@ if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]; then
Echo_message "Running debootstrap second stage under QEMU"
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}
${_EATMYDATA} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
fi
# If there's an os-release file, copy it to /etc/ and add some extra fields that identify the live image