[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}]
- [lmi-commits] [lmi] master updated (71eeb9b -> 8bc4085), Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 932c27b 01/18: Consolidate chroot step #10, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 8d2c26b 03/18: Fold unborn chroot step #12 into step #20, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 90411ba 06/18: Use a variable to reduce literal repetition, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 8054eeb 09/18: Don't create chroot's own /var before running debootstrap, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 2b00752 10/18: Note some questions for later investigation, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 7f0f5fa 04/18: Announce the installation of each chroot, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 5134131 02/18: Rearrange some independent script blocks, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master a779e6f 05/18: Give all group users access to chroot, on debian host, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master bfd3dae 07/18: Regularize debootstrap invocations,
Greg Chicares <=
- [lmi-commits] [lmi] master 0d9cf29 08/18: Clarify documentation, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 455d59e 11/18: Rearrange some script blocks, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 4a7d356 12/18: Extract marked blocks into sub-scripts #11, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 294b7bb 13/18: Let certain commands fail for the moment, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master d496c75 15/18: Move some more script blocks, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master dc2ccdb 14/18: Rearrange independent script blocks, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master af65430 16/18: Remove a redundant block, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 3776d3f 17/18: Move one script's contents into another, Greg Chicares, 2020/05/21
- [lmi-commits] [lmi] master 8bc4085 18/18: Remove a script that is no longer wanted, Greg Chicares, 2020/05/21