aboutsummaryrefslogtreecommitdiff
path: root/src/property/user.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-23 21:43:40 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-23 21:44:06 -0700
commitc32a1ee21df66606da67a09a58949dfe9e919191 (patch)
treeee35aaa3c6f11ca782fe072ebda2adb3605c9c63 /src/property/user.lisp
parent78884173ffcdf58a65ec1b89b624684f3052803c (diff)
downloadconsfigurator-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.lisp9
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)))