diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-07-25 00:12:35 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-07-25 00:12:35 +0200 |
commit | c8fa34265d6612c99fe80adfaa66edaddd4d5b0c (patch) | |
tree | 282167e6f1e0f9e2e3305448dc5ef7d9c6e4da1d /guix | |
parent | 931c132a58d86287d7a73964f9731a3b578538cc (diff) | |
download | gnu-guix-c8fa34265d6612c99fe80adfaa66edaddd4d5b0c.tar gnu-guix-c8fa34265d6612c99fe80adfaa66edaddd4d5b0c.tar.gz |
system: Add the 'system?' field for user groups.
Suggested by Mark H. Weaver.
* gnu/system/shadow.scm (<user-group>)[system?]: New field.
(%base-groups): Introduce 'system-group' macro, and use it.
* gnu/system.scm (user-group->gexp): Pass the 'system?' field.
* guix/build/activation.scm (add-group): Add #:system? and honor it.
(activate-users+groups): Handle the 'system?' field.
* gnu/system/file-systems.scm (%tty-gid): Choose an ID below 1000.
* doc/guix.texi (User Accounts): Document the 'system?' field.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/activation.scm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/guix/build/activation.scm b/guix/build/activation.scm index 9464d2157d..b04b017881 100644 --- a/guix/build/activation.scm +++ b/guix/build/activation.scm @@ -36,13 +36,14 @@ ;;; ;;; Code: -(define* (add-group name #:key gid password +(define* (add-group name #:key gid password system? (log-port (current-error-port))) "Add NAME as a user group, with the given numeric GID if specified." ;; Use 'groupadd' from the Shadow package. (format log-port "adding group '~a'...~%" name) (let ((args `(,@(if gid `("-g" ,(number->string gid)) '()) ,@(if password `("-p" ,password) '()) + ,@(if system? `("--system") '()) ,name))) (zero? (apply system* "groupadd" args)))) @@ -128,9 +129,11 @@ numeric gid or #f." ;; Then create the groups. (for-each (match-lambda - ((name password gid) + ((name password gid system?) (unless (false-if-exception (getgrnam name)) - (add-group name #:gid gid #:password password)))) + (add-group name + #:gid gid #:password password + #:system? system?)))) groups) ;; Finally create the other user accounts. |