meson: apply defaults if /etc/login.defs doesn't exist
Apply defaults for system_{uid,gid}_max even if the /etc/login.defs file doesn't exist (e.g. in Clear Linux with no changes). awk returns an empty string in case the file doesn't exist, causing meson to fail in to_int(). So set the default if output is empty. This makes the BEGIN{} blocks unnecessary, so remove them.
This commit is contained in:
parent
574432f889
commit
2f62cf3552
14
meson.build
14
meson.build
|
@ -656,8 +656,11 @@ system_uid_max = get_option('system-uid-max')
|
|||
if system_uid_max == ''
|
||||
system_uid_max = run_command(
|
||||
awk,
|
||||
'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
|
||||
'/etc/login.defs').stdout()
|
||||
'/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
|
||||
'/etc/login.defs').stdout().strip()
|
||||
if system_uid_max == ''
|
||||
system_uid_max = '999'
|
||||
endif
|
||||
endif
|
||||
system_uid_max = system_uid_max.to_int()
|
||||
conf.set('SYSTEM_UID_MAX', system_uid_max)
|
||||
|
@ -668,8 +671,11 @@ system_gid_max = get_option('system-gid-max')
|
|||
if system_gid_max == ''
|
||||
system_gid_max = run_command(
|
||||
awk,
|
||||
'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
|
||||
'/etc/login.defs').stdout()
|
||||
'/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
|
||||
'/etc/login.defs').stdout().strip()
|
||||
if system_gid_max == ''
|
||||
system_gid_max = '999'
|
||||
endif
|
||||
endif
|
||||
system_gid_max = system_gid_max.to_int()
|
||||
conf.set('SYSTEM_GID_MAX', system_gid_max)
|
||||
|
|
Loading…
Reference in New Issue