summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2021-01-21 10:42:30 -0500
committerAndrew Cady <d@cryptonomic.net>2021-01-21 10:42:30 -0500
commit436c105986e8806d53f723509986cc20564d3c85 (patch)
tree435bf9368e4e723cce4717467f8513a5d7e11f3c
parent8eae299ce90d789fc19dc4ac30493152b040a1ea (diff)
selfstrap: force-enable --real-apt, force-disabling --unpack
-rwxr-xr-xselfstrap14
1 files changed, 11 insertions, 3 deletions
diff --git a/selfstrap b/selfstrap
index 441456d..606c65e 100755
--- a/selfstrap
+++ b/selfstrap
@@ -2,8 +2,10 @@
2debian_mirror=http://httpredir.debian.org/debian 2debian_mirror=http://httpredir.debian.org/debian
3debian_security_mirror=http://security.debian.org 3debian_security_mirror=http://security.debian.org
4EXTRA_PACKAGES='apt debian-archive-keyring locales' 4EXTRA_PACKAGES='apt debian-archive-keyring locales'
5REAL_APT_INSTALL=y
5 6
6die() { printf 'Error: %s\n' "$*"; exit 1; } 7die() { printf 'Error: %s\n' "$*"; exit 1; }
8warn() { printf 'Warning: %s\n' "$*"; }
7 9
8usage() 10usage()
9{ 11{
@@ -45,7 +47,11 @@ done
45 47
46[ "$TARGET" ] || usage 48[ "$TARGET" ] || usage
47 49
48! [ "$REAL_APT_INSTALL" -a "$UNPACK_ONLY" ] || die "option --real-apt is incompatible with option --unpack" 50if [ "$REAL_APT_INSTALL" -a "$UNPACK_ONLY" ]
51then
52 warn "option --real-apt is incompatible with option --unpack; disabling --unpack"
53 UNPACK_ONLY=
54fi
49 55
50EXTRA_PACKAGES="$EXTRA_PACKAGES $*" 56EXTRA_PACKAGES="$EXTRA_PACKAGES $*"
51 57
@@ -116,7 +122,7 @@ apt_()
116 # Avoid deleting lists on the calling system. 122 # Avoid deleting lists on the calling system.
117 set -- "$@" -o APT::Get::List-Cleanup=false 123 set -- "$@" -o APT::Get::List-Cleanup=false
118 124
119 apt-"${apt_cmd}" "$@" 125 eatmydata -- apt-"${apt_cmd}" "$@"
120} 126}
121apt_get() { apt_ get "$@"; } 127apt_get() { apt_ get "$@"; }
122apt_cache() { apt_ cache "$@"; } 128apt_cache() { apt_ cache "$@"; }
@@ -462,13 +468,15 @@ if [ "$REAL_APT_INSTALL" ]; then
462 468
463 # Unpack required packages. Handles (1) 469 # Unpack required packages. Handles (1)
464 # Note: populate_rootfs() already created a necessary symlink /usr/bin/awk -> /usr/bin/mawk 470 # Note: populate_rootfs() already created a necessary symlink /usr/bin/awk -> /usr/bin/mawk
465 apt_extract $required_packages 471 apt_extract $required_packages eatmydata
466 472
467 # This handles (2). 473 # This handles (2).
468 # An alternative (used by debootstrap) is to configure base-passwd 474 # An alternative (used by debootstrap) is to configure base-passwd
469 install_etc_passwd 475 install_etc_passwd
470 476
477 prepare_chroot "$TARGET"
471 apt_get install -y $required_packages $EXTRA_PACKAGES 478 apt_get install -y $required_packages $EXTRA_PACKAGES
479 cleanup_chroot "$TARGET"
472else 480else
473 apt_extract $required_packages 481 apt_extract $required_packages
474 apt_extract $EXTRA_PACKAGES 482 apt_extract $EXTRA_PACKAGES