]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Skip getent when it's not found
authorVyacheslav Yurkov <uvv.mail@gmail.com>
Wed, 5 Feb 2025 07:14:20 +0000 (07:14 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 7 Feb 2025 00:15:46 +0000 (09:15 +0900)
meson.build

index 4298805365ad9e04c32956609286c76d38d0386d..61e3d11bfd9f852666f6c7ca5063e09dcc13647b 100644 (file)
@@ -889,13 +889,16 @@ nobody_user = get_option('nobody-user')
 nobody_group = get_option('nobody-group')
 
 if not meson.is_cross_build()
-        getent_result = run_command('getent', 'passwd', '65534', check : false)
-        if getent_result.returncode() == 0
-                name = getent_result.stdout().split(':')[0]
-                if name != nobody_user
-                        warning('\n' +
-                                'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
-                                'Your build will result in an user table setup that is incompatible with the local system.')
+        find_getent_result = find_program('getent', required : false)
+        if find_getent_result.found()
+                getent_result = run_command('getent', 'passwd', '65534', check : false)
+                if getent_result.returncode() == 0
+                        name = getent_result.stdout().split(':')[0]
+                        if name != nobody_user
+                                warning('\n' +
+                                        'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
+                                        'Your build will result in an user table setup that is incompatible with the local system.')
+                        endif
                 endif
         endif
         id_result = run_command('id', '-u', nobody_user, check : false)
@@ -908,13 +911,15 @@ if not meson.is_cross_build()
                 endif
         endif
 
-        getent_result = run_command('getent', 'group', '65534', check : false)
-        if getent_result.returncode() == 0
-                name = getent_result.stdout().split(':')[0]
-                if name != nobody_group
-                        warning('\n' +
-                                'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
-                                'Your build will result in an group table setup that is incompatible with the local system.')
+        if find_getent_result.found()
+                getent_result = run_command('getent', 'group', '65534', check : false)
+                if getent_result.returncode() == 0
+                        name = getent_result.stdout().split(':')[0]
+                        if name != nobody_group
+                                warning('\n' +
+                                        'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
+                                        'Your build will result in an group table setup that is incompatible with the local system.')
+                        endif
                 endif
         endif
         id_result = run_command('id', '-g', nobody_group, check : false)