diff options
author | Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> | 2018-02-18 18:33:16 -0800 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:54:01 +0200 |
commit | 19c61652d55203e153a7da0d795a9c6db9dc7a4b (patch) | |
tree | b7dbc8777afb5e677b02e97239b29be534eb07fb /meson.build | |
parent | cf6df4681f466a9716e2ae5a0dfaf9f1b96b6145 (diff) |
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.
(cherry picked from commit 2f62cf3552d48f518313bd6265bad6763e2b643b)
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 05bbcc67d..96fb8b134 100644 --- a/meson.build +++ b/meson.build @@ -754,8 +754,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) @@ -766,8 +769,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) |