lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master c278ec4 1/5: Mount nothing manually--let 'sch


From: Greg Chicares
Subject: [lmi-commits] [lmi] master c278ec4 1/5: Mount nothing manually--let 'schroot' handle all necessary mounts
Date: Tue, 7 Jul 2020 16:48:25 -0400 (EDT)

branch: master
commit c278ec462d6b7426c67e37efefe19423073c9b0c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Mount nothing manually--let 'schroot' handle all necessary mounts
---
 lmi_setup_00c.sh | 10 +++++++---
 lmi_setup_05c.sh |  3 ---
 lmi_setup_11.sh  | 22 +++++++---------------
 lmi_setup_13.sh  |  7 +------
 lmi_setup_13c.sh | 10 +---------
 lmi_setup_20.sh  | 36 ------------------------------------
 lmi_setup_30.sh  | 11 ++---------
 7 files changed, 18 insertions(+), 81 deletions(-)

diff --git a/lmi_setup_00c.sh b/lmi_setup_00c.sh
index b1ddae2..5da81e7 100755
--- a/lmi_setup_00c.sh
+++ b/lmi_setup_00c.sh
@@ -54,6 +54,10 @@ rm    -f /etc/schroot/lmi_profile/nssdatabases
 touch    /etc/schroot/lmi_profile/nssdatabases
 
 cat >/etc/schroot/lmi_profile/fstab <<EOF
+# For caveats, see:
+#    https://lists.nongnu.org/archive/html/lmi/2020-05/msg00040.html
+#
+# [block comment copied from 'schroot' distribution]
 # fstab: static file system information for chroots.
 # Note that the mount point will be prefixed by the chroot path
 # (CHROOT_PATH)
@@ -92,10 +96,10 @@ rinse --arch amd64 --distribution centos-7 \
   --cache-dir "${CACHEDIR}" \
   --directory /srv/chroot/centos7lmi \
 
-# There are probably a few directories here, with no regular files.
+# There are probably a few directories here, with few regular files,
+# because this script is intended to be run on a yum-free debian host.
 du   -sb /srv/chroot/centos7lmi/var/cache/yum || echo "Oops: rinse didn't 
create cache"
-mkdir -p /srv/chroot/centos7lmi/var/cache/yum
-mount --bind "${CACHEDIR}" /srv/chroot/centos7lmi/var/cache/yum
+find /srv/chroot/centos7lmi/var/cache/yum -type f -print0 | xargs -0 ls -l
 
 echo Installed centos chroot.
 
diff --git a/lmi_setup_05c.sh b/lmi_setup_05c.sh
index a3f6cbd..0b18b6b 100755
--- a/lmi_setup_05c.sh
+++ b/lmi_setup_05c.sh
@@ -46,9 +46,6 @@ chown root:tty /dev/tty
 chmod 666 /dev/ptmx
 [ -d /dev/pts  ] || mkdir /dev/pts
 
-mountpoint /dev/pts || mount -t devpts -o rw,nosuid,noexec,relatime,mode=600 
devpts /dev/pts
-mountpoint /proc    || mount -t proc -o rw,nosuid,nodev,noexec,relatime proc 
/proc
-
 findmnt /var/cache/yum
 findmnt /proc
 findmnt /dev/pts
diff --git a/lmi_setup_11.sh b/lmi_setup_11.sh
index cc122f7..c77e1a9 100755
--- a/lmi_setup_11.sh
+++ b/lmi_setup_11.sh
@@ -91,6 +91,10 @@ rm    -f /etc/schroot/lmi_profile/nssdatabases
 touch    /etc/schroot/lmi_profile/nssdatabases
 
 cat >/etc/schroot/lmi_profile/fstab <<EOF
+# For caveats, see:
+#    https://lists.nongnu.org/archive/html/lmi/2020-05/msg00040.html
+#
+# [block comment copied from 'schroot' distribution]
 # fstab: static file system information for chroots.
 # Note that the mount point will be prefixed by the chroot path
 # (CHROOT_PATH)
@@ -111,22 +115,10 @@ cat >/etc/schroot/lmi_profile/fstab <<EOF
 # /dev/nonexistent      /var/cache/nonexistent  none    rw,bind    0       0
 EOF
 
-# Experimentally show whether anything's already here:
+# Summarize what's already here--nothing if /var/cache/lmi_schroots
+# has never been populated, or a full system if these scripts have
+# been run previously:
 du   -sb /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
-# Bind-mount apt archives for the chroot's debian release. Do this:
-#   - after invoking 'debootstrap', so the chroot's /var exists; and
-#   - before invoking 'apt-get' in the chroot, to save bandwidth; and
-#   - while not chrooted, so that the host filesystem is accessible.
-mount --bind "${CACHEDIR}" /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
-
-# Show the mount just established:
-findmnt /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
-# Show any underlying mount (e.g., for an intermediate chroot):
-findmnt "${CACHEDIR}" || true
-
-# Are the next two commands useful?
-findmnt /proc
-findmnt /dev/pts
 
 stamp=$(date -u +'%Y%m%dT%H%M%SZ')
 echo "$stamp $0: Ran 'debootstrap'."  | tee /dev/tty
diff --git a/lmi_setup_13.sh b/lmi_setup_13.sh
index 830e7f7..6b7bae1 100755
--- a/lmi_setup_13.sh
+++ b/lmi_setup_13.sh
@@ -29,12 +29,7 @@ set -evx
 assert_su
 assert_not_chrooted
 
-# For caveats, see:
-#    https://lists.nongnu.org/archive/html/lmi/2020-05/msg00040.html
-mkdir -p /srv/cache_for_lmi
-du   -sb /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi || echo "Okay."
-mkdir -p /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
-mount --bind /srv/cache_for_lmi /srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
+# Nothing left to do here.
 
 stamp=$(date -u +'%Y%m%dT%H%M%SZ')
 echo "$stamp $0: Mounted cache_for_lmi."  | tee /dev/tty
diff --git a/lmi_setup_13c.sh b/lmi_setup_13c.sh
index 15bd993..eb42187 100755
--- a/lmi_setup_13c.sh
+++ b/lmi_setup_13c.sh
@@ -29,15 +29,7 @@ set -evx
 assert_su
 assert_not_chrooted
 
-CACHEDIR=/var/cache/lmi_schroots
-mkdir -p "${CACHEDIR}"
-mkdir -p /srv/chroot/centos7lmi/"${CACHEDIR}"
-mount --bind "${CACHEDIR}" /srv/chroot/centos7lmi/"${CACHEDIR}"
-
-mkdir -p /srv/cache_for_lmi
-du   -sb /srv/chroot/centos7lmi/srv/cache_for_lmi || echo "Okay."
-mkdir -p /srv/chroot/centos7lmi/srv/cache_for_lmi
-mount --bind /srv/cache_for_lmi /srv/chroot/centos7lmi/srv/cache_for_lmi
+# Nothing left to do here.
 
 stamp=$(date -u +'%Y%m%dT%H%M%SZ')
 echo "$stamp $0: Mounted cache_for_lmi [centos]."  | tee /dev/tty
diff --git a/lmi_setup_20.sh b/lmi_setup_20.sh
index acf4987..a572ed6 100755
--- a/lmi_setup_20.sh
+++ b/lmi_setup_20.sh
@@ -60,42 +60,6 @@ ln -s /bin/true /usr/bin/ischroot
 # bash logout file that clears the screen.
 sed -e'/^[^#]/s/^/# SUPPRESSED # /' -i /etc/skel/.bash_logout
 
-# This being a "plain" schroot, mount essential directories:
-mountpoint /dev/pts || mount -t devpts -o rw,nosuid,noexec,relatime,mode=600 
devpts /dev/pts
-mountpoint /proc    || mount -t proc -o rw,nosuid,nodev,noexec,relatime proc 
/proc
-
-# If the chroot is to be permanent, consider adding those mounts to /etc/fstab:
-#
-# devpts /srv/chroot/${CHRTNAME}/dev/pts devpts 
rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0
-# proc /srv/chroot/${CHRTNAME}/proc proc rw,nosuid,nodev,noexec,relatime 0 0
-#
-# If the chroot is ever to be eradicated, use 'lmi_setup_02.sh',
-# which, crucially, unmounts before removing.
-#
-# As an alternative, configure the chroot with "type=directory"
-# instead of "type=plain", so that 'schroot' mounts the appropriate
-# filesystems when the chroot is entered, and unmounts them when it
-# is exited. Then problems like this:
-#   https://lists.nongnu.org/archive/html/lmi/2019-09/msg00026.html
-# would be prevented. However, it would be necessary to adapt all of
-# the setup scripts, to avoid undesirable side effects as discussed
-# here:
-#   https://lists.gnu.org/archive/html/lmi/2016-09/msg00014.html
-# Adding a line like
-#   setup.fstab=minimal/fstab
-# to a 'plain' chroot's configuration file has no effect (and elicits
-# no diagnostic).
-#
-# See also:
-#   https://linux.die.net/man/7/schroot-faq
-# | Should I use the plain or directory chroot type? [...]
-# | plain is very simple and does not perform any setup tasks [...]
-# | directory chroots do run setup scripts, which can mount additional
-# | filesystems and do other setup tasks
-#
-# If a 'directory' chroot is to be configured, bind mounts may not be
-# shown clearly in /etc/mtab ; use 'findmnt' to see them.
-
 # Historical notes on various distros' package names.
 #
 # redhat names some packages differently:
diff --git a/lmi_setup_30.sh b/lmi_setup_30.sh
index d5fd649..8e141a4 100755
--- a/lmi_setup_30.sh
+++ b/lmi_setup_30.sh
@@ -52,15 +52,8 @@ assert_not_chrooted
 #   rm -rf /srv/cache_for_lmi/blessed/proprietary
 #   cp --dereference --preserve --recursive \
 #     /srv/chroot/some-prior-chroot/opt/lmi/blessed/ /srv/cache_for_lmi
-# to update the host, and then:
-cp --dereference --preserve --recursive \
-  /srv/cache_for_lmi/* /srv/chroot/${CHRTNAME}/srv/cache_for_lmi/ || true
-# Messages like
-#  cp: '/srv/cache_for_lmi/downloads' and
-#    '/srv/chroot/lmi_bullseye_1/srv/cache_for_lmi/downloads'
-#    are the same file
-# may arise, harmlessly, because of a mount command in an upstream
-# script.
+# to update the host; then those files will be accessible in chroots
+# created by these scripts (which mount that directory).
 
 # Also copy any desired msw software into the chroot now, e.g.:
 #   cp -a /srv/chroot/some-prior-chroot/opt/xyzzy 
/srv/chroot/${CHRTNAME}/opt/xyzzy



reply via email to

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