[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master a0df551 2/2: Resolve a regrettable inconsiste
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master a0df551 2/2: Resolve a regrettable inconsistency |
Date: |
Fri, 22 May 2020 18:51:37 -0400 (EDT) |
branch: master
commit a0df5514b669c15897d215868b9a713e0f1f52e1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Resolve a regrettable inconsistency
Somebody put this:
#root ALL = (ALL) ALL
in '/etc/sudoers'. Go figure.
---
install_centos_1.sh | 7 ++++++-
install_redhat.sh | 8 ++++++--
lmi_setup_00.sh | 7 ++++++-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/install_centos_1.sh b/install_centos_1.sh
index 172e3fc..e27dc65 100755
--- a/install_centos_1.sh
+++ b/install_centos_1.sh
@@ -46,7 +46,12 @@ mount --bind /srv/cache_for_lmi
/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
cp -a lmi_setup_*.sh /tmp/schroot_env /srv/chroot/${CHRTNAME}/tmp
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_20.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
-sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
+# On a particular corporate server, root is not a sudoer.
+if sudo -l true; then
+ sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
+else
+ su "${NORMAL_USER}"
./lmi_setup_30.sh
+fi
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_40.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_41.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_42.sh
diff --git a/install_redhat.sh b/install_redhat.sh
index 5eb3b85..51ad32d 100755
--- a/install_redhat.sh
+++ b/install_redhat.sh
@@ -103,8 +103,12 @@ mount --bind /srv/cache_for_lmi
/srv/chroot/"${CHRTNAME}"/srv/cache_for_lmi
cp -a lmi_setup_*.sh /tmp/schroot_env /srv/chroot/${CHRTNAME}/tmp
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_20.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
-# Use su instead of sudo on a server where root is not a sudoer.
-su "${NORMAL_USER}"
./lmi_setup_30.sh
+# On a particular corporate server, root is not a sudoer.
+if sudo -l true; then
+ sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
+else
+ su "${NORMAL_USER}"
./lmi_setup_30.sh
+fi
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_40.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_41.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_42.sh
diff --git a/lmi_setup_00.sh b/lmi_setup_00.sh
index 2abea7d..35fd4ce 100755
--- a/lmi_setup_00.sh
+++ b/lmi_setup_00.sh
@@ -87,7 +87,12 @@ chmod 0666 /tmp/schroot_env
cp -a lmi_setup_*.sh /tmp/schroot_env /srv/chroot/${CHRTNAME}/tmp
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_20.sh
schroot --chroot=${CHRTNAME} --user=root --directory=/tmp
./lmi_setup_21.sh
-sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
+# On a particular corporate server, root is not a sudoer.
+if sudo -l true; then
+ sudo --user="${NORMAL_USER}"
./lmi_setup_30.sh
+else
+ su "${NORMAL_USER}"
./lmi_setup_30.sh
+fi
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_40.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_41.sh
schroot --chroot=${CHRTNAME} --user="${NORMAL_USER}" --directory=/tmp
./lmi_setup_42.sh