GNU bug report logs - #40601
guix-install.sh: port to other distros & init systems

Previous Next

Package: guix-patches;

Reported by: Vincent Legoll <vincent.legoll <at> gmail.com>

Date: Mon, 13 Apr 2020 16:05:01 UTC

Severity: normal

Tags: patch

Done: Vincent Legoll <vincent.legoll <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #61 received at 40601 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Legoll <vincent.legoll <at> gmail.com>
To: 40601 <at> debbugs.gnu.org
Cc: Vincent Legoll <vincent.legoll <at> gmail.com>
Subject: [PATCH 08/28] guix-install.sh: Use getent for both user & group
 presence checking.
Date: Sun, 17 May 2020 19:17:05 +0200
* etc/guix-install.sh (sys_create_build_user): Use getent instead of id to check
presence of users, use bare getent call with output redirection for group check.
---
 etc/guix-install.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 225cf532b8..a56e0ec7b2 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -303,7 +303,7 @@ sys_create_build_user()
 
     _debug "--- [ $FUNCNAME ] ---"
 
-    if [ $(getent group guixbuild) ]; then
+    if getent group guixbuild >/dev/null 2>&1; then
         _msg "${INF}group guixbuild exists"
     else
         groupadd --system guixbuild
@@ -311,7 +311,7 @@ sys_create_build_user()
     fi
 
     for i in $(seq -w 1 10); do
-        if id "guixbuilder${i}" &>/dev/null; then
+        if getent passwd "guixbuilder${i}" >/dev/null 2>&1; then
             _msg "${INF}user is already in the system, reset"
             usermod -g guixbuild -G guixbuild           \
                     -d /var/empty -s "$(which nologin)" \
-- 
2.26.2





This bug report was last modified 345 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.