diff options
Diffstat (limited to 'selfstrap')
-rwxr-xr-x | selfstrap | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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 | ||
181 | cleanup_chroot() | 186 | cleanup_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 |
506 | else | 511 | else |
507 | apt_extract $required_packages | 512 | apt_extract $required_packages |
508 | apt_extract $EXTRA_PACKAGES | 513 | apt_extract $EXTRA_PACKAGES |