summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>2018-02-18 18:33:16 -0800
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:58:58 +0200
commit6aa3ef01f65ac3ca0d949d4534f8bcd796f1a053 (patch)
treec902240e7205edfd22b1ea7af42560f80beea19a /meson.build
parent6074e92552ced541803bbed62c877e795ddddc17 (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.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build14
1 files changed, 10 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index b4bb15932..696223298 100644
--- a/meson.build
+++ b/meson.build
@@ -759,8 +759,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)
@@ -771,8 +774,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)