lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 62cb276 4/5: Improve indentation


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 62cb276 4/5: Improve indentation
Date: Thu, 18 Jun 2020 22:42:57 -0400 (EDT)

branch: master
commit 62cb276feb1b7d81d2bef94f0fa58ee5d278ca62
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Improve indentation
---
 lmi_setup_24.sh  | 52 +++++++++++++++----------------
 lmi_setup_24c.sh | 94 ++++++++++++++++++++++++++++----------------------------
 2 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/lmi_setup_24.sh b/lmi_setup_24.sh
index 14e6e8f..8a5e1b5 100755
--- a/lmi_setup_24.sh
+++ b/lmi_setup_24.sh
@@ -36,36 +36,36 @@ getent group 1001 || groupadd --gid=1001 lmi || echo "Oops."
 
 for user in $(echo "${CHROOT_USERS}" | tr ',' '\n'); do
 {
-# Add a normal user, setting its shell and groups.
-#
-# No attempt is made to set a real password, because that can't be
-# done securely in a script. A better password can be set later,
-# interactively, if desired. Forcing the dummy password to expire
-# immediately, thus (e.g.):
-#   chage -d 0 "${user}"
-# may seem like a good idea, but invoking schroot with that userid
-# doesn't prompt for a password change.
-#
-# Hardcode the salt so that repeated openssl invocations yield
-# identical results, to avoid gratuitous regressions when comparing
-# successive logs.
+  # Add a normal user, setting its shell and groups.
+  #
+  # No attempt is made to set a real password, because that can't be
+  # done securely in a script. A better password can be set later,
+  # interactively, if desired. Forcing the dummy password to expire
+  # immediately, thus (e.g.):
+  #   chage -d 0 "${user}"
+  # may seem like a good idea, but invoking schroot with that userid
+  # doesn't prompt for a password change.
+  #
+  # Hardcode the salt so that repeated openssl invocations yield
+  # identical results, to avoid gratuitous regressions when comparing
+  # successive logs.
 
-useradd \
-  --gid="${NORMAL_GROUP_GID}" \
-  --create-home \
-  --shell=/bin/zsh \
-  --password="$(openssl passwd -1 --salt '' expired)" \
-  "${user}"
+  useradd \
+    --gid="${NORMAL_GROUP_GID}" \
+    --create-home \
+    --shell=/bin/zsh \
+    --password="$(openssl passwd -1 --salt '' expired)" \
+    "${user}"
 
-# Try to make the "normal" user's UID match its UID on the host.
-if [ "${NORMAL_USER}" = "${user}" ]; then
-  usermod -u "${NORMAL_USER_UID}" "${NORMAL_USER}" || echo "Oops."
-fi
+  # Try to make the "normal" user's UID match its UID on the host.
+  if [ "${NORMAL_USER}" = "${user}" ]; then
+    usermod -u "${NORMAL_USER_UID}" "${NORMAL_USER}" || echo "Oops."
+  fi
 
-usermod -aG lmi  "${user}" || echo "Oops."
-usermod -aG sudo "${user}" || echo "Oops."
+  usermod -aG lmi  "${user}" || echo "Oops."
+  usermod -aG sudo "${user}" || echo "Oops."
 
-chsh -s /bin/zsh "${user}"
+  chsh -s /bin/zsh "${user}"
 } done
 
 stamp=$(date -u +'%Y%m%dT%H%M%SZ')
diff --git a/lmi_setup_24c.sh b/lmi_setup_24c.sh
index 631267f..d289b94 100755
--- a/lmi_setup_24c.sh
+++ b/lmi_setup_24c.sh
@@ -36,58 +36,58 @@ getent group 1001 || groupadd --gid=1001 lmi || echo "Oops."
 
 for user in $(echo "${CHROOT_USERS}" | tr ',' '\n'); do
 {
-# Add a normal user, setting its shell and groups.
-#
-# This minimal centos chroot lacks openssl, so hardcode a password.
+  # Add a normal user, setting its shell and groups.
+  #
+  # This minimal centos chroot lacks openssl, so hardcode a password.
 
-useradd \
-  --gid="${NORMAL_GROUP_GID}" \
-  --create-home \
-  --shell=/bin/zsh \
-  --password="\$1\$\$AYD8bMyx6ho3BnmO3jjb60" \
-  "${user}"
+  useradd \
+    --gid="${NORMAL_GROUP_GID}" \
+    --create-home \
+    --shell=/bin/zsh \
+    --password="\$1\$\$AYD8bMyx6ho3BnmO3jjb60" \
+    "${user}"
 
-# Try to make the "normal" user's UID match its UID on the host.
-if [ "${NORMAL_USER}" = "${user}" ]; then
-  usermod -u "${NORMAL_USER_UID}" || echo "Oops."
-fi
+  # Try to make the "normal" user's UID match its UID on the host.
+  if [ "${NORMAL_USER}" = "${user}" ]; then
+    usermod -u "${NORMAL_USER_UID}" || echo "Oops."
+  fi
 
-usermod -aG lmi  "${user}" || echo "Oops."
+  usermod -aG lmi  "${user}" || echo "Oops."
 
-# Where debian has a 'sudo' group, redhat has a 'wheel' group.
-# The difference seems to be nominal; neither is GID 0.
-usermod -aG wheel "${user}"
-# Nevertheless, after exiting the chroot and reentering as 'greg':
-#   $groups greg
-#   greg : lmi wheel
-#   $sudo visudo
-#   sudo: no tty present and no askpass program specified
-#   $sudo -S visudo
-#   greg is not in the sudoers file.  This incident will be reported.
-#   $visudo
-#   greg is not in the sudoers file.
-#   $newgrp wheel
-#   $sudo visudo
-#   sudo: no tty present and no askpass program specified
-# even though the default /etc/sudoers contains:
-#   %wheel<Tab>ALL=(ALL)<Tab>ALL
-# Enabling the 'wheel' group with no password and disabling
-# 'requiretty', as shown below, didn't suffice...so explicitly add
-# the normal user:
-{
-  printf '# Customizations:\n'
-  printf '\n'
-  printf '# Disable "requiretty" if necessary--see:\n'
-  printf '#   https://bugzilla.redhat.com/show_bug.cgi?id=1020147\n'
-  printf '# Defaults    !requiretty\n'
-  printf '\n'
-  printf '%%wheel\tALL=(ALL)\tNOPASSWD: ALL\n'
-  printf -- '%s\tALL=(ALL)\tNOPASSWD: ALL\n' "${user}"
-} >/etc/sudoers.d/"${user}"
-chmod 0440 /etc/sudoers.d/"${user}"
-visudo -cs
+  # Where debian has a 'sudo' group, redhat has a 'wheel' group.
+  # The difference seems to be nominal; neither is GID 0.
+  usermod -aG wheel "${user}"
+  # Nevertheless, after exiting the chroot and reentering as 'greg':
+  #   $groups greg
+  #   greg : lmi wheel
+  #   $sudo visudo
+  #   sudo: no tty present and no askpass program specified
+  #   $sudo -S visudo
+  #   greg is not in the sudoers file.  This incident will be reported.
+  #   $visudo
+  #   greg is not in the sudoers file.
+  #   $newgrp wheel
+  #   $sudo visudo
+  #   sudo: no tty present and no askpass program specified
+  # even though the default /etc/sudoers contains:
+  #   %wheel<Tab>ALL=(ALL)<Tab>ALL
+  # Enabling the 'wheel' group with no password and disabling
+  # 'requiretty', as shown below, didn't suffice...so explicitly add
+  # the normal user:
+  {
+    printf '# Customizations:\n'
+    printf '\n'
+    printf '# Disable "requiretty" if necessary--see:\n'
+    printf '#   https://bugzilla.redhat.com/show_bug.cgi?id=1020147\n'
+    printf '# Defaults    !requiretty\n'
+    printf '\n'
+    printf '%%wheel\tALL=(ALL)\tNOPASSWD: ALL\n'
+    printf -- '%s\tALL=(ALL)\tNOPASSWD: ALL\n' "${user}"
+  } >/etc/sudoers.d/"${user}"
+  chmod 0440 /etc/sudoers.d/"${user}"
+  visudo -cs
 
-chsh -s /bin/zsh "${user}"
+  chsh -s /bin/zsh "${user}"
 } done
 
 stamp=$(date -u +'%Y%m%dT%H%M%SZ')



reply via email to

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