check nobody user/group validity only when not cross compiling

Using `getent' and `id' command in case of cross compiling does not
make much sense. This is because it is the host files that are checked.

Besides, in some restricted cross compilation environment, these two
command may not even be available. This is to avoid host comtamination.

So we should only check the validity using getent and id when not
cross compiling.
This commit is contained in:
Chen Qi 2018-07-23 14:53:09 +08:00 committed by Lennart Poettering
parent 0ffa4c7c4b
commit 2484bff32b

View file

@ -689,6 +689,7 @@ substs.set('containeruidbasemax', container_uid_base_max)
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')
if getent_result.returncode() == 0
name = getent_result.stdout().split(':')[0]
@ -726,6 +727,7 @@ if id_result.returncode() == 0
'Your build will result in an group table setup that is incompatible with the local system.')
endif
endif
endif
if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
warning('\n' +
'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +