Skip to content

Commit 263220a

Browse files
committed
guix: Check for a sane services database
On bare systems, it is possible to be lacking a services database. Check for basic entries before attempting a build. See the error message in the diff for more context.
1 parent 4129134 commit 263220a

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

contrib/guix/guix-build

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/libexec/prelude.bash"
1818
# Required non-builtin commands should be invocable
1919
################
2020

21-
check_tools cat mkdir make git guix
21+
check_tools cat mkdir make getent git guix
2222

2323
################
2424
# GUIX_BUILD_OPTIONS should be empty
@@ -186,6 +186,29 @@ fi
186186
#
187187
# However, the internal API is likely to change more than the CLI invocation
188188

189+
################
190+
# Services database must have basic entries
191+
################
192+
193+
if ! getent services http https ftp; then
194+
cat << EOF
195+
ERR: Your system's C library can not find service database entries for at least
196+
one of the following services: http, https, ftp.
197+
198+
Hint: Most likely, /etc/services does not exist yet (common for docker images
199+
and minimal distros), or you don't have permissions to access it.
200+
201+
If /etc/services does not exist yet, you may want to install the
202+
appropriate package for your distro which provides it.
203+
204+
On Debian/Ubuntu: netbase
205+
On Arch Linux: iana-etc
206+
207+
For more information, see: getent(1), services(5)
208+
209+
EOF
210+
211+
fi
189212

190213
#########
191214
# SETUP #

0 commit comments

Comments
 (0)