diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-23 21:43:40 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-03-23 21:44:06 -0700 |
commit | c32a1ee21df66606da67a09a58949dfe9e919191 (patch) | |
tree | ee35aaa3c6f11ca782fe072ebda2adb3605c9c63 /src/property/user.lisp | |
parent | 78884173ffcdf58a65ec1b89b624684f3052803c (diff) | |
download | consfigurator-c32a1ee21df66606da67a09a58949dfe9e919191.tar.gz |
USER:PASSWD-ENTRY: use MRUN & accept UIDs
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/user.lisp')
-rw-r--r-- | src/property/user.lisp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/property/user.lisp b/src/property/user.lisp index c96af2a..705678c 100644 --- a/src/property/user.lisp +++ b/src/property/user.lisp @@ -37,9 +37,12 @@ (file:contains-lines "/etc/shells" shell) (mrun "chsh" "--shell" shell username))) -(defun passwd-entry (n username) - (nth n (split-string (stripln (run "getent" "passwd" username)) - :separator ":"))) +(defun passwd-entry (n username-or-uid) + (let ((u (etypecase username-or-uid + (string username-or-uid) + (number (write-to-string username-or-uid))))) + (nth n (split-string (stripln (mrun "getent" "passwd" u)) + :separator ":")))) (defun user-exists (username) (zerop (run :for-exit "getent" "passwd" username))) |