From e2fcc23a3a562b9efa55530f442bba4bd0436d4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Wed, 4 Jun 2014 23:08:09 +0200
Subject: [PATCH] activation: Only create groups that do not exist yet.

Before that the effect would be to re-create groups at each boot, and
thus remove any members of the groups.

* guix/build/activation.scm (activate-users+groups): Call 'add-group'
  only when (getgrname name) fails.
---
 guix/build/activation.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/build/activation.scm b/guix/build/activation.scm
index 62e69a91528..bc62a94e017 100644
--- a/guix/build/activation.scm
+++ b/guix/build/activation.scm
@@ -126,7 +126,8 @@ (define activate-user
   ;; Then create the groups.
   (for-each (match-lambda
              ((name password gid)
-              (add-group name #:gid gid #:password password)))
+              (unless (false-if-exception (getgrnam name))
+                (add-group name #:gid gid #:password password))))
             groups)
 
   ;; Finally create the other user accounts.
-- 
GitLab