lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] odd/rh_server df80604: Attempt, forlornly, to use `l


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/rh_server df80604: Attempt, forlornly, to use `logname` on redhat server
Date: Mon, 24 Feb 2020 11:28:26 -0500 (EST)

branch: odd/rh_server
commit df8060433b30033bc739565643700a504d10d80e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Attempt, forlornly, to use `logname` on redhat server
    
    Hardcoding 'NORMAL_USER=greg' etc. is okay on a single-user machine.
    On a corporate redhat server where we cannot create user accounts, the
    quickest workaround is to edit the setup file by hand, but that's not
    generally appropriate.
    
    Calling logname seemed like a good idea, but this server uses something
    like LDAP and doesn't show normal users in /etc/passwd , and it seems
    impossible to find the login name from within 'sudo schroot -u root'.
    
    Other options:
     - Maintain a ~/.lmi_identity file; but then '~' must be found by some
       means other than /home/$(logname), if that's even possible
     - pass parameters to schroot as
         schroot [options] -- sh -c "FOO=bar ./eraseme.sh"
       which is blecherous
     - pass parameters to schroot as "user-modifiable keys"; but that seems
       to affect only the environment in which schroot startup scripts run,
       rather than the environment of the schroot itself
    The last of those options seems clearly best. It requires changing the
    schroot 'type' from 'plain' to 'directory'. But that change must be made
    anyway, for schroot-1.7.3:
    
      https://gitlab.com/codelibre/schroot/-/blob/master/NEWS.md
    | The plain, loopback, lvm-snapshot and block-device chroot types have
    | been removed.
    
    and is desirable because it enables automatic mounting of required
    directories like /proc and /dev/pts .
---
 lmi_setup_inc.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lmi_setup_inc.sh b/lmi_setup_inc.sh
index bbd2196..f8eac42 100755
--- a/lmi_setup_inc.sh
+++ b/lmi_setup_inc.sh
@@ -28,15 +28,20 @@
 # shellcheck disable=SC2034
 #   (this file should only be sourced)
 
+# $(logname) should do what POSIX says, even if gnome disagrees:
+#   https://bugzilla.gnome.org/show_bug.cgi?id=747046
+# A more complicated method can be considered if this becomes an
+# actual problem for lmi.
+
 set -vx
 
 CODENAME=bullseye
 CHRTVER=1
 CHRTNAME=lmi_${CODENAME}_${CHRTVER}
-NORMAL_USER=greg
-NORMAL_USER_UID=1000
-NORMAL_GROUP=greg
-NORMAL_GROUP_GID=1000
+NORMAL_USER=$(id -un "$(logname)")
+NORMAL_USER_UID=$(id -u "$(logname)")
+NORMAL_GROUP=$(id -gn "$(logname)")
+NORMAL_GROUP_GID=$(id -g "$(logname)")
 GIT_URL_BASE=https://git.savannah.nongnu.org/cgit/lmi.git/plain
 # For a server that, bizarrely, blocks gnu.org but allows github.com:
 # GIT_URL_BASE=https://github.com/vadz/lmi/raw/master



reply via email to

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