[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master eb7edf5 6/9: Perform dynamic configuration ea
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master eb7edf5 6/9: Perform dynamic configuration earlier |
Date: |
Wed, 20 May 2020 18:14:05 -0400 (EDT) |
branch: master
commit eb7edf54be7ab0a4f0fb4c51aac6ea8a3e6d5692
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Perform dynamic configuration earlier
The dynamic configuration depends only on 'logname' and 'id', so there
are no steps that must precede it.
---
install_centos.sh | 14 +++++++-------
install_redhat.sh | 58 +++++++++++++++++++++++++++----------------------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/install_centos.sh b/install_centos.sh
index 3a11128..28bc296 100755
--- a/install_centos.sh
+++ b/install_centos.sh
@@ -56,13 +56,6 @@ 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
# variables across sudo and schroot barriers.
@@ -92,6 +85,13 @@ set +v
EOF
chmod 0666 /tmp/schroot_env
+# 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
+
set -evx
cat >/etc/schroot/chroot.d/centos7lmi.conf <<EOF
diff --git a/install_redhat.sh b/install_redhat.sh
index c925d0f..cd7f9e8 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -53,6 +53,35 @@ set -evx
assert_su
assert_not_chrooted
+# Store dynamic configuration in a temporary file. This method is
+# simple and robust, and far better than trying to pass environment
+# variables across sudo and schroot barriers.
+
+ NORMAL_USER=$(id -un "$(logname)")
+ NORMAL_USER_UID=$(id -u "$(logname)")
+
+if getent group lmi; then
+ NORMAL_GROUP=lmi
+ NORMAL_GROUP_GID=$(getent group "$NORMAL_GROUP" | cut -d: -f3)
+ CHROOT_USERS=$(getent group "$NORMAL_GROUP" | cut -d: -f4)
+else
+ NORMAL_GROUP=$(id -gn "$(logname)")
+ NORMAL_GROUP_GID=$(id -g "$(logname)")
+ CHROOT_USERS=$(id -un "$(logname)")
+fi
+
+cat >/tmp/schroot_env <<EOF
+set -v
+ CHROOT_USERS=$CHROOT_USERS
+ GIT_URL_BASE=$GIT_URL_BASE
+ NORMAL_GROUP=$NORMAL_GROUP
+NORMAL_GROUP_GID=$NORMAL_GROUP_GID
+ NORMAL_USER=$NORMAL_USER
+ NORMAL_USER_UID=$NORMAL_USER_UID
+set +v
+EOF
+chmod 0666 /tmp/schroot_env
+
# 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
@@ -146,35 +175,6 @@ echo Installed debian "${CODENAME}".
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
-# variables across sudo and schroot barriers.
-
- NORMAL_USER=$(id -un "$(logname)")
- NORMAL_USER_UID=$(id -u "$(logname)")
-
-if getent group lmi; then
- NORMAL_GROUP=lmi
- NORMAL_GROUP_GID=$(getent group "$NORMAL_GROUP" | cut -d: -f3)
- CHROOT_USERS=$(getent group "$NORMAL_GROUP" | cut -d: -f4)
-else
- NORMAL_GROUP=$(id -gn "$(logname)")
- NORMAL_GROUP_GID=$(id -g "$(logname)")
- CHROOT_USERS=$(id -un "$(logname)")
-fi
-
-cat >/tmp/schroot_env <<EOF
-set -v
- CHROOT_USERS=$CHROOT_USERS
- GIT_URL_BASE=$GIT_URL_BASE
- NORMAL_GROUP=$NORMAL_GROUP
-NORMAL_GROUP_GID=$NORMAL_GROUP_GID
- NORMAL_USER=$NORMAL_USER
- NORMAL_USER_UID=$NORMAL_USER_UID
-set +v
-EOF
-chmod 0666 /tmp/schroot_env
-
# BEGIN ./lmi_setup_11.sh
cat >/etc/schroot/chroot.d/"${CHRTNAME}".conf <<EOF
[${CHRTNAME}]
- [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 <=
- [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, 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