lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master bfd3dae 07/18: Regularize debootstrap invocat


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bfd3dae 07/18: Regularize debootstrap invocations
Date: Thu, 21 May 2020 19:43:11 -0400 (EDT)

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

    Regularize debootstrap invocations
    
    Also initialized $CACHEDIR where it was missing, for debootstrap's use.
---
 install_centos_1.sh | 23 +++++++++++++++++++++--
 install_redhat.sh   | 20 ++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/install_centos_1.sh b/install_centos_1.sh
index 30c7178..3a5becc 100755
--- a/install_centos_1.sh
+++ b/install_centos_1.sh
@@ -38,9 +38,28 @@ yum --assumeyes install debootstrap schroot
 # END   ./lmi_setup_10.sh
 
 # BEGIN ./lmi_setup_11.sh
-# Install a debian chroot inside this centos chroot.
+# 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 "${CODENAME}" /srv/chroot/"${CHRTNAME}" 
http://deb.debian.org/debian/
+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:
+grep --invert-match '^I:' "${CHRTNAME}"-debootstrap-log
 
 echo Installed debian "${CODENAME}" chroot.
 # END   ./lmi_setup_11.sh
diff --git a/install_redhat.sh b/install_redhat.sh
index a53bf1e..5795626 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -95,15 +95,31 @@ yum --assumeyes install debootstrap schroot
 # ./lmi_setup_10.sh
 
 # BEGIN ./lmi_setup_11.sh
+# 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}"
 du   -sb /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives || echo "Okay."
 mkdir -p /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
 mount --bind "${CACHEDIR}" /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
 
-# Install a debian chroot inside this redhat chroot.
+# 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 "${CODENAME}" /srv/chroot/"${CHRTNAME}" 
http://deb.debian.org/debian/
+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:
+grep --invert-match '^I:' "${CHRTNAME}"-debootstrap-log
 
 cat >/etc/schroot/chroot.d/"${CHRTNAME}".conf <<EOF
 [${CHRTNAME}]



reply via email to

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