mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 07:37:21 +02:00
Add option to specify privileged gamemode group
This commit is contained in:
parent
e34e9c5a43
commit
1e24067430
@ -1 +1 @@
|
|||||||
@@LIMITSGROUP@ - nice -10
|
@@GAMEMODE_PRIVILEGED_GROUP@ - nice -10
|
||||||
|
@ -1 +0,0 @@
|
|||||||
g gamemode - -
|
|
1
data/gamemode.conf.in
Normal file
1
data/gamemode.conf.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
g @GAMEMODE_PRIVILEGED_GROUP@ - -
|
@ -4,6 +4,7 @@ data_conf.set('LIBEXECDIR', path_libexecdir)
|
|||||||
data_conf.set('SYSCONFDIR', path_sysconfdir)
|
data_conf.set('SYSCONFDIR', path_sysconfdir)
|
||||||
data_conf.set('GAMEMODE_PREFIX', path_prefix)
|
data_conf.set('GAMEMODE_PREFIX', path_prefix)
|
||||||
data_conf.set('GAMEMODE_VERSION', meson.project_version())
|
data_conf.set('GAMEMODE_VERSION', meson.project_version())
|
||||||
|
data_conf.set('GAMEMODE_PRIVILEGED_GROUP', with_privileged_group)
|
||||||
|
|
||||||
# Pull in the example config
|
# Pull in the example config
|
||||||
config_example = run_command(
|
config_example = run_command(
|
||||||
@ -25,13 +26,25 @@ if sd_bus_provider == 'systemd'
|
|||||||
endif
|
endif
|
||||||
if with_systemd_group
|
if with_systemd_group
|
||||||
# Install the sysusers.d file
|
# Install the sysusers.d file
|
||||||
install_data(
|
configure_file(
|
||||||
files('gamemode.conf'),
|
input: 'gamemode.conf.in',
|
||||||
install_dir: path_systemd_group_dir,
|
output: 'gamemode.conf',
|
||||||
|
configuration: data_conf,
|
||||||
|
install_dir: path_systemd_group_dir,
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if with_pam_renicing
|
||||||
|
# Install the limits.d configuration file
|
||||||
|
configure_file(
|
||||||
|
input: '10-gamemode.conf.in',
|
||||||
|
output: '10-gamemode.conf',
|
||||||
|
configuration: data_conf,
|
||||||
|
install_dir: '/etc/security/limits.d',
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
# Install the D-BUS service file
|
# Install the D-BUS service file
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'com.feralinteractive.GameMode.service.in',
|
input: 'com.feralinteractive.GameMode.service.in',
|
||||||
|
37
meson.build
37
meson.build
@ -102,6 +102,8 @@ dep_threads = dependency('threads')
|
|||||||
# On non glibc systems this might be a stub, i.e. for musl
|
# On non glibc systems this might be a stub, i.e. for musl
|
||||||
libdl = cc.find_library('dl', required: false)
|
libdl = cc.find_library('dl', required: false)
|
||||||
|
|
||||||
|
with_privileged_group = get_option('with-privileged-group')
|
||||||
|
|
||||||
# Determine the location for the systemd unit
|
# Determine the location for the systemd unit
|
||||||
if sd_bus_provider == 'systemd'
|
if sd_bus_provider == 'systemd'
|
||||||
with_systemd_unit = get_option('with-systemd-user-unit')
|
with_systemd_unit = get_option('with-systemd-user-unit')
|
||||||
@ -113,28 +115,25 @@ if sd_bus_provider == 'systemd'
|
|||||||
path_systemd_unit_dir = pkgconfig_systemd.get_pkgconfig_variable('systemduserunitdir')
|
path_systemd_unit_dir = pkgconfig_systemd.get_pkgconfig_variable('systemduserunitdir')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
with_systemd_group = get_option('with-systemd-group')
|
if with_privileged_group != ''
|
||||||
if with_systemd_group
|
with_systemd_group = get_option('with-systemd-group')
|
||||||
path_systemd_group_dir = get_option('with-systemd-group-dir')
|
if with_systemd_group
|
||||||
if path_systemd_group_dir == ''
|
path_systemd_group_dir = get_option('with-systemd-group-dir')
|
||||||
message('Asking pkg-config for systemd\'s \'sysusersdir\' directory')
|
if path_systemd_group_dir == ''
|
||||||
pkgconfig_systemd = dependency('systemd')
|
message('Asking pkg-config for systemd\'s \'sysusersdir\' directory')
|
||||||
path_systemd_group_dir = pkgconfig_systemd.get_pkgconfig_variable('sysusersdir')
|
pkgconfig_systemd = dependency('systemd')
|
||||||
endif
|
path_systemd_group_dir = pkgconfig_systemd.get_pkgconfig_variable('sysusersdir')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
with_systemd_group = false
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
with_limits_conf = get_option('with-pam-group')
|
if with_privileged_group != ''
|
||||||
if with_limits_conf != ''
|
with_pam_renicing = get_option('with-pam-renicing')
|
||||||
ldata = configuration_data()
|
else
|
||||||
ldata.set('LIMITSGROUP', with_limits_conf)
|
with_pam_renicing = false
|
||||||
# Install the limits.d configuration file
|
|
||||||
configure_file(
|
|
||||||
input: 'data/10-gamemode.conf.in',
|
|
||||||
output: '10-gamemode.conf',
|
|
||||||
configuration: ldata,
|
|
||||||
install_dir: '/etc/security/limits.d',
|
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Set the dbus path as appropriate.
|
# Set the dbus path as appropriate.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# limits.d
|
# limits.d
|
||||||
option('with-pam-group', type: 'string', description: 'Install the limits.d configuration file to allow renicing as an unpriviledged user being part of the specified group')
|
option('with-pam-renicing', type: 'boolean', description: 'Install the limits.d configuration file to allow renicing as a user being part of the privileged gamemode group', value: 'true')
|
||||||
|
|
||||||
# sd-bus provider
|
# sd-bus provider
|
||||||
option('with-sd-bus-provider', type: 'combo', choices: ['systemd', 'elogind', 'no-daemon'], value: 'systemd')
|
option('with-sd-bus-provider', type: 'combo', choices: ['systemd', 'elogind', 'no-daemon'], value: 'systemd')
|
||||||
@ -7,7 +7,7 @@ option('with-sd-bus-provider', type: 'combo', choices: ['systemd', 'elogind', 'n
|
|||||||
# systemd specific
|
# systemd specific
|
||||||
option('with-systemd-user-unit', type: 'boolean', description: 'Install systemd user unit', value: 'true')
|
option('with-systemd-user-unit', type: 'boolean', description: 'Install systemd user unit', value: 'true')
|
||||||
option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory')
|
option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory')
|
||||||
option('with-systemd-group', type: 'boolean', description: 'Install systemd group', value: 'true')
|
option('with-systemd-group', type: 'boolean', description: 'Install privileged gamemode group with systemd', value: 'true')
|
||||||
option('with-systemd-group-dir', type: 'string', description: 'Explicitly set the systemd group directory')
|
option('with-systemd-group-dir', type: 'string', description: 'Explicitly set the systemd group directory')
|
||||||
|
|
||||||
# Not using systemd
|
# Not using systemd
|
||||||
@ -16,3 +16,4 @@ option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the
|
|||||||
# General options
|
# General options
|
||||||
option('with-examples', type: 'boolean', description: 'Build sample programs', value: 'true')
|
option('with-examples', type: 'boolean', description: 'Build sample programs', value: 'true')
|
||||||
option('with-util', type: 'boolean', description: 'Build the utilities', value: 'true')
|
option('with-util', type: 'boolean', description: 'Build the utilities', value: 'true')
|
||||||
|
option('with-privileged-group', type: 'string', description: 'Group that has access to privileged gamemode features', value: 'gamemode')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user