[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0125e0f 8/9: Extract marked blocks into sub-s
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0125e0f 8/9: Extract marked blocks into sub-scripts #05 |
Date: |
Wed, 20 May 2020 18:14:06 -0400 (EDT) |
branch: master
commit 0125e0f5d49bcf56fde74f9fb2e7f3ffdb8cb770
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Extract marked blocks into sub-scripts #05
---
install_centos.sh | 1 +
install_centos_1.sh | 36 +-------------------
install_redhat.sh | 31 ++----------------
install_centos_1.sh => lmi_setup_05c.sh | 49 ++--------------------------
lmi_setup_05r.sh | 58 +++++++++++++++++++++++++++++++++
5 files changed, 64 insertions(+), 111 deletions(-)
diff --git a/install_centos.sh b/install_centos.sh
index f683bf3..e4c5eb5 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -35,6 +35,7 @@ else
fi
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_02c.sh
+wget -N -nv "${GIT_URL_BASE}"/lmi_setup_05c.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_10.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_11.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_20.sh
diff --git a/install_centos_1.sh b/install_centos_1.sh
index 101620b..8697d94 100755
--- a/install_centos_1.sh
+++ b/install_centos_1.sh
@@ -29,41 +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.
-
-[ -c /dev/null ] || ( rm /dev/null; mknod /dev/null c 1 3)
-chmod 666 /dev/null
-[ -c /dev/ptmx ] || mknod /dev/ptmx c 5 2
-chmod 666 /dev/ptmx
-[ -d /dev/pts ] || mkdir /dev/pts
-
-getent group "${NORMAL_GROUP}" || groupadd --gid="${NORMAL_GROUP_GID}"
"${NORMAL_GROUP}"
-getent passwd "${NORMAL_USER}" || useradd \
- --gid="${NORMAL_GROUP_GID}" \
- --uid="${NORMAL_USER_UID}" \
- --create-home \
- --shell=/bin/zsh \
- --password="$(openssl passwd -1 expired)" \
- "${NORMAL_USER}"
-
-usermod -aG sudo "${NORMAL_USER}" || echo "Oops."
-
-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
-
-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
+./lmi_setup_05c.sh
# BEGIN ./lmi_setup_07.sh
# Suppress a nuisance: rh-based distributions provide a default
diff --git a/install_redhat.sh b/install_redhat.sh
index 64a3982..a4c5b6f 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -35,6 +35,7 @@ else
fi
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_02.sh
+wget -N -nv "${GIT_URL_BASE}"/lmi_setup_05r.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_10.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_11.sh
wget -N -nv "${GIT_URL_BASE}"/lmi_setup_20.sh
@@ -85,35 +86,7 @@ chmod 0666 /tmp/schroot_env
./lmi_setup_02.sh
-# BEGIN ./lmi_setup_05.sh
-umount /srv/chroot
-
-# On a server with tiny 4G partitions for /usr, /var, /tmp, /opt,
-# etc., no partition had room for a chroot. Using RAM:
-# mount -t tmpfs -o size=10G tmpfs /srv
-# was sufficient for a proof of concept, but for real work it's
-# necessary to obtain sufficient storage, e.g.:
-# parted --align optimal /dev/sdb -- mklabel msdos mkpart primary ext4 1MiB
-1MiB
-# e2label /dev/sdb1 lmi
-# mkdir /lmi
-# chgrp lmi /lmi
-# echo "LABEL=lmi /srv/chroot ext4 defaults 0 0" >> /etc/fstab
-# partprobe
-# mount -a
-# To change from ext4 to xfs, unmount and...
-# mkfs.xfs -f -L lmi /dev/sdb1
-# after which
-# blkid /dev/sdb1
-# should show
-# /dev/sdb2: LABEL="lmi" ... TYPE="xfs"
-# Then do:
-# echo "LABEL=lmi /srv/chroot xfs defaults 0 0" >> /etc/fstab
-# removing any former /srv/chroot line.
-#
-# Here, explicitly remount /srv/chroot because it was umounted above:
-mount LABEL=lmi /srv/chroot
-findmnt /srv/chroot
-# END ./lmi_setup_05.sh
+./lmi_setup_05r.sh
# BEGIN ./lmi_setup_11.sh
mkdir -p /var/cache/"${CODENAME}"
diff --git a/install_centos_1.sh b/lmi_setup_05c.sh
similarity index 51%
copy from install_centos_1.sh
copy to lmi_setup_05c.sh
index 101620b..ea3f5ad 100755
--- a/install_centos_1.sh
+++ b/lmi_setup_05c.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Create a chroot for cross-building "Let me illustrate..." on centos-7.
+# Create a chroot for cross-building "Let me illustrate...".
#
# Copyright (C) 2016, 2017, 2018, 2019, 2020 Gregory W. Chicares.
#
@@ -24,12 +24,11 @@
. ./lmi_setup_inc.sh
. /tmp/schroot_env
-set -evx
+set -vx
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.
@@ -63,47 +62,3 @@ 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
-
-# Make a more modern 'git' available via 'scl'. This is not needed
-# if all real work is done in a debian chroot.
-#yum --assumeyes install centos-release-scl
-#yum-config-manager --enable rhel-server-rhscl-7-rpms
-#yum --assumeyes install devtoolset-8 rh-git218
-# In order to use the tools on the three preceding lines, do:
-# scl enable devtoolset-8 rh-git218 $SHELL
-# and then they'll be available in that environment.
-
-# Fix weird errors like "Problem with the SSL CA cert (path? access rights?)".
-# Try 'update' before 'install' as described here:
-# https://lists.nongnu.org/archive/html/lmi/2020-02/msg00003.html
-yum --assumeyes update ca-certificates curl nss-pem
-yum --assumeyes install ca-certificates curl nss-pem
-
-# Install "EPEL" by using 'rpm' directly [historical]. See:
-# https://lists.nongnu.org/archive/html/lmi/2019-09/msg00037.html
-#rpm -ivh
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-# 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/lmi_setup_05r.sh b/lmi_setup_05r.sh
new file mode 100755
index 0000000..540125c
--- /dev/null
+++ b/lmi_setup_05r.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Create a chroot for cross-building "Let me illustrate...".
+#
+# Copyright (C) 2016, 2017, 2018, 2019, 2020 Gregory W. Chicares.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# http://savannah.nongnu.org/projects/lmi
+# email: <address@hidden>
+# snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+. ./lmi_setup_inc.sh
+. /tmp/schroot_env
+
+set -vx
+
+assert_su
+assert_not_chrooted
+
+umount /srv/chroot
+
+# On a server with tiny 4G partitions for /usr, /var, /tmp, /opt,
+# etc., no partition had room for a chroot. Using RAM:
+# mount -t tmpfs -o size=10G tmpfs /srv
+# was sufficient for a proof of concept, but for real work it's
+# necessary to obtain sufficient storage, e.g.:
+# parted --align optimal /dev/sdb -- mklabel msdos mkpart primary ext4 1MiB
-1MiB
+# e2label /dev/sdb1 lmi
+# mkdir /lmi
+# chgrp lmi /lmi
+# echo "LABEL=lmi /srv/chroot ext4 defaults 0 0" >> /etc/fstab
+# partprobe
+# mount -a
+# To change from ext4 to xfs, unmount and...
+# mkfs.xfs -f -L lmi /dev/sdb1
+# after which
+# blkid /dev/sdb1
+# should show
+# /dev/sdb2: LABEL="lmi" ... TYPE="xfs"
+# Then do:
+# echo "LABEL=lmi /srv/chroot xfs defaults 0 0" >> /etc/fstab
+# removing any former /srv/chroot line.
+#
+# Here, explicitly remount /srv/chroot because it was umounted above:
+mount LABEL=lmi /srv/chroot
+findmnt /srv/chroot
- [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 <=
- [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, 2020/05/20
- [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