[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 32da141 5/9: Mark script blocks for extractio
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 32da141 5/9: Mark script blocks for extraction into sub-scripts |
Date: |
Wed, 20 May 2020 18:14:05 -0400 (EDT) |
branch: master
commit 32da141b36f35c364025f0fd414b0bc1f1e5665f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Mark script blocks for extraction into sub-scripts
---
install_centos.sh | 4 ++++
install_centos_1.sh | 8 ++++++++
install_redhat.sh | 17 +++++++++++++++++
3 files changed, 29 insertions(+)
diff --git a/install_centos.sh b/install_centos.sh
index 301469d..3a11128 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -56,10 +56,12 @@ set -evx
assert_su
assert_not_chrooted
+# BEGIN ./lmi_setup_02.sh
# First, destroy any chroot left by a prior run.
grep centos /proc/mounts | cut -f2 -d" " | xargs --no-run-if-empty umount
rm -rf /srv/chroot/centos7lmi
rm /etc/schroot/chroot.d/centos7lmi.conf
+# END ./lmi_setup_02.sh
# Store dynamic configuration in a temporary file. This method is
# simple and robust, and far better than trying to pass environment
@@ -139,6 +141,7 @@ cp -a ~/.zshrc
/srv/chroot/centos7lmi/home/"${NORMAL_USER}"/.zshrc
# If that works well, then treat vim configuration the same way,
# here and elsewhere.
+# BEGIN ./lmi_setup_11.sh
cat >/srv/chroot/centos7lmi/etc/schroot/chroot.d/"${CHRTNAME}".conf <<EOF
[${CHRTNAME}]
aliases=lmi
@@ -159,6 +162,7 @@ mount --bind /srv/cache_for_lmi
/srv/chroot/centos7lmi/srv/cache_for_lmi
du -sb /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi ||
echo "Okay."
mkdir -p /srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
mount --bind /srv/cache_for_lmi
/srv/chroot/centos7lmi/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
+# END ./lmi_setup_11.sh
schroot --chroot=centos7lmi --user=root --directory=/tmp ./install_centos_2.sh
diff --git a/install_centos_1.sh b/install_centos_1.sh
index 5fb39da..101620b 100755
--- a/install_centos_1.sh
+++ b/install_centos_1.sh
@@ -29,6 +29,7 @@ set -evx
assert_su
assert_not_chrooted
+# BEGIN ./lmi_setup_05.sh
# A _normal_ file /dev/null seems to be created automatically:
# -rw-r--r-- 1 root root 0 Oct 1 15:44 /dev/null
# so it needs to be removed to create the pseudo-device.
@@ -62,7 +63,9 @@ sed -i /etc/yum.conf -e's/keepcache=0/keepcache=1/'
yum --assumeyes install ncurses-term less sudo vim zsh
chsh -s /bin/zsh root
chsh -s /bin/zsh "${NORMAL_USER}"
+# END ./lmi_setup_05.sh
+# BEGIN ./lmi_setup_07.sh
# Suppress a nuisance: rh-based distributions provide a default
# zsh logout file that clears the screen.
sed -e'/^[^#]/s/^/# SUPPRESSED # /' -i /etc/zlogout
@@ -88,14 +91,19 @@ yum --assumeyes install ca-certificates curl nss-pem
# Instead, use 'yum' to install "EPEL".
#yum --assumeyes install
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum --assumeyes install epel-release
+# END ./lmi_setup_07.sh
+# BEGIN ./lmi_setup_10.sh
yum --assumeyes install schroot
# To show available debootstrap scripts:
# ls /usr/share/debootstrap/scripts
+# END ./lmi_setup_10.sh
+# BEGIN ./lmi_setup_11.sh
# Install a debian chroot inside this centos chroot.
yum --assumeyes install debootstrap
mkdir -p /srv/chroot/"${CHRTNAME}"
debootstrap "${CODENAME}" /srv/chroot/"${CHRTNAME}"
http://deb.debian.org/debian/
echo Installed debian "${CODENAME}".
+# END ./lmi_setup_11.sh
diff --git a/install_redhat.sh b/install_redhat.sh
index 9ac5d94..c925d0f 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -53,10 +53,14 @@ set -evx
assert_su
assert_not_chrooted
+# BEGIN ./lmi_setup_02.sh
# First, destroy any chroot left by a prior run.
grep "${CHRTNAME}" /proc/mounts | cut -f2 -d" " | xargs --no-run-if-empty
umount
rm -rf /srv/chroot/"${CHRTNAME}"
rm /etc/schroot/chroot.d/"${CHRTNAME}".conf || echo "None?"
+# END ./lmi_setup_02.sh
+
+# BEGIN ./lmi_setup_05.sh
umount /srv/chroot
# On a server with tiny 4G partitions for /usr, /var, /tmp, /opt,
@@ -84,12 +88,16 @@ umount /srv/chroot
# Here, explicitly remount /srv/chroot because it was umounted above:
mount LABEL=lmi /srv/chroot
findmnt /srv/chroot
+# END ./lmi_setup_05.sh
+# BEGIN ./lmi_setup_11.sh
mkdir -p /var/cache/"${CODENAME}"
du -sb /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives || echo "Okay."
mkdir -p /srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
mount --bind /var/cache/"${CODENAME}"
/srv/chroot/"${CHRTNAME}"/var/cache/apt/archives
+# END ./lmi_setup_11.sh
+# BEGIN ./lmi_setup_07.sh
# Suppress a nuisance: rh-based distributions provide a default
# zsh logout file that clears the screen.
sed -e'/^[^#]/s/^/# SUPPRESSED # /' -i /etc/zlogout
@@ -115,21 +123,28 @@ yum --assumeyes install ca-certificates curl nss-pem
# Instead, use 'yum' to install "EPEL".
#yum --assumeyes install
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum --assumeyes install epel-release
+# END ./lmi_setup_07.sh
+# BEGIN ./lmi_setup_10.sh
yum --assumeyes install schroot
# To show available debootstrap scripts:
# ls /usr/share/debootstrap/scripts
+# END ./lmi_setup_10.sh
+# BEGIN ./lmi_setup_11.sh
# Install a debian chroot inside this redhat chroot.
yum --assumeyes install debootstrap
mkdir -p /srv/chroot/"${CHRTNAME}"
debootstrap "${CODENAME}" /srv/chroot/"${CHRTNAME}"
http://deb.debian.org/debian/
echo Installed debian "${CODENAME}".
+# END ./lmi_setup_11.sh
+# BEGIN ./lmi_setup_12.sh
# Suppress a nuisance: debian-based distributions provide a default
# bash logout file that clears the screen.
sed -e'/^[^#]/s/^/# SUPPRESSED # /' -i
/srv/chroot/"${CHRTNAME}"/etc/skel/.bash_logout
+# END ./lmi_setup_12.sh
# Store dynamic configuration in a temporary file. This method is
# simple and robust, and far better than trying to pass environment
@@ -160,6 +175,7 @@ set +v
EOF
chmod 0666 /tmp/schroot_env
+# BEGIN ./lmi_setup_11.sh
cat >/etc/schroot/chroot.d/"${CHRTNAME}".conf <<EOF
[${CHRTNAME}]
aliases=lmi
@@ -176,6 +192,7 @@ 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
+# END ./lmi_setup_11.sh
# ./lmi_setup_10.sh
# ./lmi_setup_11.sh
- [lmi-commits] [lmi] master updated (c193ba1 -> 71eeb9b), Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 4b512a0 1/9: Adjust copyright notices, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 05d51fe 3/9: Change the meaning of "chrooted" assertions, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 237f11e 2/9: Refactor a too-complex script, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master eb7edf5 6/9: Perform dynamic configuration earlier, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 0125e0f 8/9: Extract marked blocks into sub-scripts #05, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 71eeb9b 9/9: Extract marked blocks into sub-scripts #07, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 32da141 5/9: Mark script blocks for extraction into sub-scripts,
Greg Chicares <=
- [lmi-commits] [lmi] master 70a5c91 4/9: Remove a gratuitous difference in 'yum' commands, Greg Chicares, 2020/05/20
- [lmi-commits] [lmi] master 7583624 7/9: Extract marked blocks into sub-scripts #02, Greg Chicares, 2020/05/20