mirror of
https://github.com/systemd/systemd
synced 2024-10-06 16:21:34 +00:00
meson: print warnings if the "nobody" user/group name is not compatible with the local system
At least on Fedora and Debian systems this not obvious to get right, hence warn.
This commit is contained in:
parent
66d73cc728
commit
afde45740f
49
meson.build
49
meson.build
|
@ -640,8 +640,49 @@ conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
|
||||||
substs.set('containeruidbasemin', container_uid_base_min)
|
substs.set('containeruidbasemin', container_uid_base_min)
|
||||||
substs.set('containeruidbasemax', container_uid_base_max)
|
substs.set('containeruidbasemax', container_uid_base_max)
|
||||||
|
|
||||||
conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
|
nobody_user = get_option('nobody-user')
|
||||||
conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
|
nobody_group = get_option('nobody-group')
|
||||||
|
|
||||||
|
getent_result = run_command('getent', 'passwd', '65534')
|
||||||
|
if getent_result.returncode() == 0
|
||||||
|
name = getent_result.stdout().split(':')[0]
|
||||||
|
if name != nobody_user
|
||||||
|
message('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
|
||||||
|
id_result = run_command('id', '-u', nobody_user)
|
||||||
|
if id_result.returncode() == 0
|
||||||
|
id = id_result.stdout().to_int()
|
||||||
|
if id != 65534
|
||||||
|
message('WARNING:\n' +
|
||||||
|
' The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
|
||||||
|
' Your build will result in an user table setup that is incompatible with the local system.')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
getent_result = run_command('getent', 'group', '65534')
|
||||||
|
if getent_result.returncode() == 0
|
||||||
|
name = getent_result.stdout().split(':')[0]
|
||||||
|
if name != nobody_group
|
||||||
|
message('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
|
||||||
|
id_result = run_command('id', '-g', nobody_group)
|
||||||
|
if id_result.returncode() == 0
|
||||||
|
id = id_result.stdout().to_int()
|
||||||
|
if id != 65534
|
||||||
|
message('WARNING:\n' +
|
||||||
|
' The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
|
||||||
|
' Your build will result in an group table setup that is incompatible with the local system.')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
conf.set_quoted('NOBODY_USER_NAME', nobody_user)
|
||||||
|
conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
|
||||||
|
|
||||||
tty_gid = get_option('tty-gid')
|
tty_gid = get_option('tty-gid')
|
||||||
conf.set('TTY_GID', tty_gid)
|
conf.set('TTY_GID', tty_gid)
|
||||||
|
@ -2528,8 +2569,8 @@ status = [
|
||||||
'render group access mode: @0@'.format(get_option('group-render-mode')),
|
'render group access mode: @0@'.format(get_option('group-render-mode')),
|
||||||
'certificate root directory: @0@'.format(get_option('certificate-root')),
|
'certificate root directory: @0@'.format(get_option('certificate-root')),
|
||||||
'support URL: @0@'.format(support_url),
|
'support URL: @0@'.format(support_url),
|
||||||
'nobody user name: @0@'.format(get_option('nobody-user')),
|
'nobody user name: @0@'.format(nobody_user),
|
||||||
'nobody group name: @0@'.format(get_option('nobody-group')),
|
'nobody group name: @0@'.format(nobody_group),
|
||||||
'fallback hostname: @0@'.format(get_option('fallback-hostname')),
|
'fallback hostname: @0@'.format(get_option('fallback-hostname')),
|
||||||
'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
|
'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue