diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-03-03 21:57:26 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-03-07 20:05:09 +0100 |
commit | 6061d01512081c93c53fdd1d4302b36696403061 (patch) | |
tree | a4d93dd7406207be146008023fd867578482bfbd /gnu/system/shadow.scm | |
parent | f6f67b87c08fe7b901db834c714aceaef2b62b60 (diff) | |
download | patches-6061d01512081c93c53fdd1d4302b36696403061.tar patches-6061d01512081c93c53fdd1d4302b36696403061.tar.gz |
activation: Operate on <user-account> and <user-group> records.
* gnu/system/accounts.scm (sexp->user-group, sexp->user-account): New
procedures.
* gnu/system/shadow.scm (account-activation): Call them in the arguments
to 'activate-users+groups'.
(account-shepherd-service): Likewise.
* gnu/build/activation.scm (activate-users+groups): Expect a list of
<user-account> and a list of <user-group>. Replace uses of 'match' on
tuples with calls to record accessors.
(activate-user-home): Likewise.
Diffstat (limited to 'gnu/system/shadow.scm')
-rw-r--r-- | gnu/system/shadow.scm | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index a9a4afd414..4e5b6ae5f2 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -298,11 +298,14 @@ group." (assert-valid-users/groups accounts groups) ;; Add users and user groups. - #~(begin - (setenv "PATH" - (string-append #$(@ (gnu packages admin) shadow) "/sbin")) - (activate-users+groups (list #$@user-specs) - (list #$@group-specs)))) + (with-imported-modules (source-module-closure '((gnu system accounts))) + #~(begin + (use-modules (gnu system accounts)) + + (setenv "PATH" + (string-append #$(@ (gnu packages admin) shadow) "/sbin")) + (activate-users+groups (map sexp->user-account (list #$@user-specs)) + (map sexp->user-group (list #$@group-specs)))))) (define (account-shepherd-service accounts+groups) "Return a Shepherd service that creates the home directories for the user @@ -322,12 +325,15 @@ accounts among ACCOUNTS+GROUPS." (list (shepherd-service (requirement '(file-systems)) (provision '(user-homes)) - (modules '((gnu build activation))) + (modules '((gnu build activation) + (gnu system accounts))) (start (with-imported-modules (source-module-closure - '((gnu build activation))) + '((gnu build activation) + (gnu system accounts))) #~(lambda () (activate-user-home - (list #$@(map user-account->gexp accounts))) + (map sexp->user-account + (list #$@(map user-account->gexp accounts)))) #f))) ;stop (stop #~(const #f)) (respawn? #f) |