From 8a4082068dc40900711e1e749a8dbf921efb0e5d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 15 Nov 2024 11:32:34 +0100 Subject: [PATCH] meson: add -D tty-setgid=[false|true] If your distribution does not define permissions for installed binaries and follows the upstream guidelines, disabling the tty group's setgid could be a beneficial decision in certain situations. Signed-off-by: Karel Zak --- meson.build | 11 +++++++++-- meson_options.txt | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 6b0bfe1e0..addcca253 100644 --- a/meson.build +++ b/meson.build @@ -2675,6 +2675,13 @@ if opt bashcompletions += ['mesg'] endif +tty_setgid = get_option('tty-setgid') +if tty_setgid + tty_install_mode = [ 'rwxr-sr-x', 'root', 'tty' ] +else + tty_install_mode = [ false, false, false ] +endif + opt = not get_option('build-wall').disabled() exe = executable( 'wall', @@ -2683,7 +2690,7 @@ exe = executable( link_with : [lib_common], dependencies : [lib_systemd], install_dir : usrbin_exec_dir, - install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], + install_mode : tty_install_mode, install : opt, build_by_default : opt) if opt @@ -2703,7 +2710,7 @@ exe = executable( link_with : [lib_common], dependencies : [lib_systemd], install_dir : usrbin_exec_dir, - install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], + install_mode : tty_install_mode, install : opt, build_by_default : opt) if opt diff --git a/meson_options.txt b/meson_options.txt index 2c7b2d1c0..aa1af7841 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -309,3 +309,7 @@ option('lastlog-compat-symlink', type : 'boolean', option('login-lastlogin', type : 'boolean', value : false, description : 'program login writes lastlog entries') + +option('tty-setgid', type : 'boolean', + value : true, + description : 'setgid tty group for wall and write programs') -- 2.47.2