lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 94a6deb 2/2: Invoke debootstrap in a single s


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 94a6deb 2/2: Invoke debootstrap in a single step
Date: Sun, 17 May 2020 12:19:29 -0400 (EDT)

branch: master
commit 94a6debfa3debbed6ec8f6d988759fd5dc02b6c5
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Invoke debootstrap in a single step
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2020-05/msg00025.html
---
 lmi_setup_10.sh  |  9 ---------
 lmi_setup_11.sh  | 30 ++++++++++++++++++++----------
 lmi_setup_inc.sh |  2 +-
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/lmi_setup_10.sh b/lmi_setup_10.sh
index 40fe070..364abd1 100755
--- a/lmi_setup_10.sh
+++ b/lmi_setup_10.sh
@@ -31,12 +31,3 @@ assert_not_chrooted
 
 apt-get update
 apt-get --assume-yes install schroot debootstrap
-
-# Download all OS essentials. This step may be done a single time, and
-# its tarball used repeatedly. The target ('/tmp/eraseme') directory
-# will be created and erased automatically.
-
-if [ ! -e /var/cache/"${CODENAME}"_bootstrap.tar ]; then
-  debootstrap --arch=amd64 
--make-tarball=/var/cache/"${CODENAME}"_bootstrap.tar \
-   "${CODENAME}" /tmp/eraseme
-fi
diff --git a/lmi_setup_11.sh b/lmi_setup_11.sh
index ff76a78..8057267 100755
--- a/lmi_setup_11.sh
+++ b/lmi_setup_11.sh
@@ -29,9 +29,24 @@ set -vx
 assert_su
 assert_not_chrooted
 
-# Unpack the OS tarball into the particular chroot being created.
+# Cache apt archives for the chroot's debian release, to save a great
+# deal of bandwidth if multiple chroots are created with the same
+# release. Do this:
+#   - before invoking 'debootstrap' (or 'apt-get' in the chroot),
+#     so that all packages are cached; and
+#   - while not chrooted, so that the host filesystem is accessible.
+# The alternative of rbind-mounting parent directory var/cache/apt
+# might be investigated.
+CACHEDIR=/var/cache/"${CODENAME}"
+mkdir -p "${CACHEDIR}"
+
+# Bootstrap a minimal debian system. Options:
+#   --include=zsh, because of "shell=/bin/zsh" below
+#   --variant=minbase, as explained here:
+#     https://lists.nongnu.org/archive/html/lmi/2020-05/msg00026.html
 mkdir -p /srv/chroot/"${CHRTNAME}"
-debootstrap --arch=amd64 
--unpack-tarball=/var/cache/"${CODENAME}"_bootstrap.tar \
+debootstrap --arch=amd64 --cache-dir="${CACHEDIR}" \
+ --variant=minbase --include=zsh \
  "${CODENAME}" /srv/chroot/"${CHRTNAME}" >"${CHRTNAME}"-debootstrap-log 2>&1
 
 # This command should produce no output:
@@ -49,17 +64,12 @@ shell=/bin/zsh
 type=plain
 EOF
 
-# Bind-mount apt archives for the chroot's debian release, to save a
-# great deal of bandwidth if multiple chroots are created with the
-# same release. Do this:
+# Bind-mount apt archives for the chroot's debian release. Do this:
 #   - after invoking 'debootstrap', so that /var exists; and
 #   - before invoking 'apt-get' in the chroot, to save bandwidth; and
 #   - while not chrooted, so that the host filesystem is accessible.
-# The alternative of rbind-mounting parent directory var/cache/apt is
-# not used because it's more complicated and has no benefit.
-mkdir -p /var/cache/"${CODENAME}"
-mount --bind /var/cache/"${CODENAME}" 
/srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
+mount --bind "${CACHEDIR}" /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
 
-findmnt /var/cache/"${CODENAME}"
+findmnt "${CACHEDIR}"
 findmnt /proc
 findmnt /dev/pts
diff --git a/lmi_setup_inc.sh b/lmi_setup_inc.sh
index f0fd18a..c4b2ab9 100755
--- a/lmi_setup_inc.sh
+++ b/lmi_setup_inc.sh
@@ -31,7 +31,7 @@
 set -vx
 
 CODENAME=bullseye
-CHRTVER=1
+CHRTVER=2
 CHRTNAME=lmi_${CODENAME}_${CHRTVER}
 
 umask



reply via email to

[Prev in Thread] Current Thread [Next in Thread]