Hi! In a small container image, I do not have the 'which' tool installed. I believe 'command -v' is always available since it is /bin/sh standard. How about changing the idiom for user/group additions from 'which' to 'command -v'? See attached patch.
/Simon
From 2bc261126a84a4a9a33acea9f107ad4bdef929d0 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Wed, 18 Dec 2024 21:30:10 +0100 Subject: [PATCH] guix-install.sh: Use "command -v nologin" instead of "which nologin". * doc/guix.texi (Build Environment Setup): Change. * etc/guix-install.sh (sys_create_build_user): Likewise. * gnu/machine/digital-ocean.scm (guix-infect): Update. --- doc/guix.texi | 6 +++--- etc/guix-install.sh | 4 ++-- gnu/machine/digital-ocean.scm | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f7b7569887..46ceb71cde 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -944,9 +944,9 @@ Bash syntax and the @code{shadow} commands): # groupadd --system guixbuild # for i in $(seq -w 1 10); do - useradd -g guixbuild -G guixbuild \ - -d /var/empty -s $(which nologin) \ - -c "Guix build user $i" --system \ + useradd -g guixbuild -G guixbuild \ + -d /var/empty -s $(command -v nologin) \ + -c "Guix build user $i" --system \ guixbuilder$i; done @end example diff --git a/etc/guix-install.sh b/etc/guix-install.sh index f07b2741bb..44b3e62ed2 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -435,12 +435,12 @@ sys_create_build_user() if id "guixbuilder${i}" &>/dev/null; then _msg "${INF}user is already in the system, reset" usermod -g guixbuild -G guixbuild${KVMGROUP} \ - -d /var/empty -s "$(which nologin)" \ + -d /var/empty -s "$(command -v nologin)" \ -c "Guix build user $i" \ "guixbuilder${i}"; else useradd -g guixbuild -G guixbuild${KVMGROUP} \ - -d /var/empty -s "$(which nologin)" \ + -d /var/empty -s "$(command -v nologin)" \ -c "Guix build user $i" --system \ "guixbuilder${i}"; _msg "${PAS}user added <guixbuilder${i}>" diff --git a/gnu/machine/digital-ocean.scm b/gnu/machine/digital-ocean.scm index d0f0bbe4cb..5fa679ab8c 100644 --- a/gnu/machine/digital-ocean.scm +++ b/gnu/machine/digital-ocean.scm @@ -260,7 +260,7 @@ (define os groupadd --system guixbuild for i in `seq -w 1 10`; do useradd -g guixbuild -G guixbuild \ - -d /var/empty -s `which nologin` \ + -d /var/empty -s `command -v nologin` \ -c \"Guix build user $i\" --system \ guixbuilder$i; done; -- 2.46.0
signature.asc
Description: PGP signature