lmi-commits
[Top][All Lists]
Advanced

[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}]



reply via email to

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