From c8fa34265d6612c99fe80adfaa66edaddd4d5b0c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 25 Jul 2014 00:12:35 +0200 Subject: system: Add the 'system?' field for user groups. Suggested by Mark H. Weaver. * gnu/system/shadow.scm ()[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. --- guix/build/activation.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'guix/build') 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 @@ (define-module (guix build activation) ;;; ;;; 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 @@ (define activate-user ;; 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. -- cgit v1.2.3