From b80ddd38bab7c88a0e0bfbb96d8d3bf55531000d Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 11 Jan 2022 01:54:31 -0500 Subject: avoid apt_extract --- selfstrap | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/selfstrap b/selfstrap index 45fd9e8..6e528da 100755 --- a/selfstrap +++ b/selfstrap @@ -125,9 +125,14 @@ apt_() # Avoid deleting lists on the calling system. set -- "$@" -o APT::Get::List-Cleanup=false + set -- apt-"${apt_cmd}" "$@" + if command -v eatmydata >/dev/null + then + set -- eatmydata -- "$@" + fi ( set -x - eatmydata -- apt-"${apt_cmd}" "$@" + "$@" ) r=$? if [ "$r" != 0 ] @@ -173,9 +178,9 @@ prepare_chroot() [ "$TARGET" ] || die 'no $TARGET' [ -d "$TARGET"/proc ] || mkdir "$TARGET"/proc [ -d "$TARGET"/sys ] || mkdir "$TARGET"/sys - mount -t proc proc "$TARGET"/proc - mount -t sysfs sysfs "$TARGET"/sys - mount -t tmpfs tmpfs "$TARGET"/dev + mountpoint -q "$TARGET"/proc || mount -t proc proc "$TARGET"/proc + mountpoint -q "$TARGET"/sys || mount -t sysfs sysfs "$TARGET"/sys + mountpoint -q "$TARGET"/dev || mount -t tmpfs tmpfs "$TARGET"/dev } cleanup_chroot() @@ -494,7 +499,7 @@ if [ "$REAL_APT_INSTALL" ]; then # Unpack required packages. Handles (1) # Note: populate_rootfs() already created a necessary symlink /usr/bin/awk -> /usr/bin/mawk - apt_extract $required_packages eatmydata + apt_get install -y $required_packages eatmydata # This handles (2). # An alternative (used by debootstrap) is to configure base-passwd @@ -502,7 +507,7 @@ if [ "$REAL_APT_INSTALL" ]; then prepare_chroot "$TARGET" trap 'cleanup_chroot "$TARGET"' EXIT - apt_get install -y $required_packages $EXTRA_PACKAGES + apt_get install -y $EXTRA_PACKAGES else apt_extract $required_packages apt_extract $EXTRA_PACKAGES -- cgit v1.2.3