summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-01-11 01:54:31 -0500
committerAndrew Cady <d@cryptonomic.net>2022-01-11 01:54:31 -0500
commitb80ddd38bab7c88a0e0bfbb96d8d3bf55531000d (patch)
tree65b2d48557beb9fac3a3dc2c87496cf64356ffcf
parent6f194a0642ec6e1b5be3459079705e33bc251056 (diff)
avoid apt_extract
-rwxr-xr-xselfstrap17
1 files changed, 11 insertions, 6 deletions
diff --git a/selfstrap b/selfstrap
index 45fd9e8..6e528da 100755
--- a/selfstrap
+++ b/selfstrap
@@ -125,9 +125,14 @@ apt_()
125 # Avoid deleting lists on the calling system. 125 # Avoid deleting lists on the calling system.
126 set -- "$@" -o APT::Get::List-Cleanup=false 126 set -- "$@" -o APT::Get::List-Cleanup=false
127 127
128 set -- apt-"${apt_cmd}" "$@"
129 if command -v eatmydata >/dev/null
130 then
131 set -- eatmydata -- "$@"
132 fi
128 ( 133 (
129 set -x 134 set -x
130 eatmydata -- apt-"${apt_cmd}" "$@" 135 "$@"
131 ) 136 )
132 r=$? 137 r=$?
133 if [ "$r" != 0 ] 138 if [ "$r" != 0 ]
@@ -173,9 +178,9 @@ prepare_chroot()
173 [ "$TARGET" ] || die 'no $TARGET' 178 [ "$TARGET" ] || die 'no $TARGET'
174 [ -d "$TARGET"/proc ] || mkdir "$TARGET"/proc 179 [ -d "$TARGET"/proc ] || mkdir "$TARGET"/proc
175 [ -d "$TARGET"/sys ] || mkdir "$TARGET"/sys 180 [ -d "$TARGET"/sys ] || mkdir "$TARGET"/sys
176 mount -t proc proc "$TARGET"/proc 181 mountpoint -q "$TARGET"/proc || mount -t proc proc "$TARGET"/proc
177 mount -t sysfs sysfs "$TARGET"/sys 182 mountpoint -q "$TARGET"/sys || mount -t sysfs sysfs "$TARGET"/sys
178 mount -t tmpfs tmpfs "$TARGET"/dev 183 mountpoint -q "$TARGET"/dev || mount -t tmpfs tmpfs "$TARGET"/dev
179} 184}
180 185
181cleanup_chroot() 186cleanup_chroot()
@@ -494,7 +499,7 @@ if [ "$REAL_APT_INSTALL" ]; then
494 499
495 # Unpack required packages. Handles (1) 500 # Unpack required packages. Handles (1)
496 # Note: populate_rootfs() already created a necessary symlink /usr/bin/awk -> /usr/bin/mawk 501 # Note: populate_rootfs() already created a necessary symlink /usr/bin/awk -> /usr/bin/mawk
497 apt_extract $required_packages eatmydata 502 apt_get install -y $required_packages eatmydata
498 503
499 # This handles (2). 504 # This handles (2).
500 # An alternative (used by debootstrap) is to configure base-passwd 505 # An alternative (used by debootstrap) is to configure base-passwd
@@ -502,7 +507,7 @@ if [ "$REAL_APT_INSTALL" ]; then
502 507
503 prepare_chroot "$TARGET" 508 prepare_chroot "$TARGET"
504 trap 'cleanup_chroot "$TARGET"' EXIT 509 trap 'cleanup_chroot "$TARGET"' EXIT
505 apt_get install -y $required_packages $EXTRA_PACKAGES 510 apt_get install -y $EXTRA_PACKAGES
506else 511else
507 apt_extract $required_packages 512 apt_extract $required_packages
508 apt_extract $EXTRA_PACKAGES 513 apt_extract $EXTRA_PACKAGES