From bf33a614c39498dcd68d99db360d577b65cb371d Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Mon, 7 Nov 2022 16:17:05 +0100 Subject: [PATCH] add mini-mmdebstrap in shell to the man page --- mmdebstrap | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 5f17228..5a7b06d 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6030,7 +6030,8 @@ B creates a Debian chroot of I into I from one or more Is. It is meant as an alternative to the debootstrap tool (see section B). In contrast to debootstrap it uses apt to resolve dependencies and is thus able to use more than one mirror and resolve more -complex dependencies. +complex dependencies. See section B for an overview of how +B works internally. If no I option is provided, L is used. If I is a stable release name and no I is specified, then @@ -6757,7 +6758,28 @@ retained. =head1 OPERATION -This section gives an overview of the different steps to create a chroot. +This section gives an overview of the different steps to create a chroot. At +its core, what B does can be put into a 14 line shell script: + + mkdir -p "$2/etc/apt" "$2/var/cache" + cat << END > "$2/apt.conf" + Apt::Architecture "$(dpkg --print-architecture)"; + Apt::Architectures "$(dpkg --print-architecture)"; + Dir "$(cd "$2" && pwd)"; + Dir::Etc::Trusted "$(eval "$(apt-config shell v Dir::Etc::Trusted/f)"; printf "$v")"; + Dir::Etc::TrustedParts "$(eval "$(apt-config shell v Dir::Etc::TrustedParts/d)"; printf "$v")"; + END + echo "deb http://deb.debian.org/debian/ $1 main" > "$2/etc/apt/sources.list" + APT_CONFIG="$2/apt.conf" apt-get update + APT_CONFIG="$2/apt.conf" apt-get --yes --download-only install '?essential' + for f in "$2"/var/cache/apt/archives/*.deb; do dpkg-deb --extract "$f" "$2"; done + chroot "$2" sh -c "dpkg --install --force-depends /var/cache/apt/archives/*.deb" + +The additional complexity of B is to support operation without +superuser privileges, bit-by-bit reproducible output, hooks and foreign +architecture support. + +The remainder of this section explains what B does step-by-step. =over 8