mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 07:37:21 +02:00
Scope polkit actions to require the privileged group
This commit is contained in:
parent
898ab01924
commit
337f1b8a8e
@ -54,13 +54,21 @@ configure_file(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Install the Polkit action file in all cases
|
# Install the Polkit action & rule files for the privileged gamemode group
|
||||||
configure_file(
|
if with_privileged_group != ''
|
||||||
input: 'polkit/actions/com.feralinteractive.GameMode.policy.in',
|
configure_file(
|
||||||
output: 'com.feralinteractive.GameMode.policy',
|
input: 'polkit/actions/com.feralinteractive.GameMode.policy.in',
|
||||||
configuration: data_conf,
|
output: 'com.feralinteractive.GameMode.policy',
|
||||||
install_dir: path_polkit_action_dir,
|
configuration: data_conf,
|
||||||
)
|
install_dir: path_polkit_action_dir,
|
||||||
|
)
|
||||||
|
configure_file(
|
||||||
|
input: 'polkit/rules.d/gamemode.rules.in',
|
||||||
|
output: 'gamemode.rules',
|
||||||
|
configuration: data_conf,
|
||||||
|
install_dir: path_polkit_rule_dir,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
# Install the helper run script
|
# Install the helper run script
|
||||||
install_data(
|
install_data(
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<defaults>
|
<defaults>
|
||||||
<allow_any>no</allow_any>
|
<allow_any>no</allow_any>
|
||||||
<allow_inactive>no</allow_inactive>
|
<allow_inactive>no</allow_inactive>
|
||||||
<allow_active>yes</allow_active>
|
<allow_active>no</allow_active>
|
||||||
</defaults>
|
</defaults>
|
||||||
<annotate key="org.freedesktop.policykit.exec.path">@LIBEXECDIR@/cpugovctl</annotate>
|
<annotate key="org.freedesktop.policykit.exec.path">@LIBEXECDIR@/cpugovctl</annotate>
|
||||||
</action>
|
</action>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<defaults>
|
<defaults>
|
||||||
<allow_any>no</allow_any>
|
<allow_any>no</allow_any>
|
||||||
<allow_inactive>no</allow_inactive>
|
<allow_inactive>no</allow_inactive>
|
||||||
<allow_active>yes</allow_active>
|
<allow_active>no</allow_active>
|
||||||
</defaults>
|
</defaults>
|
||||||
<annotate key="org.freedesktop.policykit.exec.path">@LIBEXECDIR@/gpuclockctl</annotate>
|
<annotate key="org.freedesktop.policykit.exec.path">@LIBEXECDIR@/gpuclockctl</annotate>
|
||||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||||
|
12
data/polkit/rules.d/gamemode.rules.in
Normal file
12
data/polkit/rules.d/gamemode.rules.in
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Allow users in privileged gamemode group to run cpugovctl &
|
||||||
|
* gpuclockctl without authentication
|
||||||
|
*/
|
||||||
|
polkit.addRule(function (action, subject) {
|
||||||
|
if ((action.id == "com.feralinteractive.GameMode.governor-helper" ||
|
||||||
|
action.id == "com.feralinteractive.GameMode.gpu-helper") &&
|
||||||
|
subject.isInGroup("@GAMEMODE_PRIVILEGED_GROUP@"))
|
||||||
|
{
|
||||||
|
return polkit.Result.YES;
|
||||||
|
}
|
||||||
|
});
|
@ -142,7 +142,9 @@ if path_dbus_service_dir == ''
|
|||||||
path_dbus_service_dir = join_paths(path_datadir, 'dbus-1', 'services')
|
path_dbus_service_dir = join_paths(path_datadir, 'dbus-1', 'services')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
path_polkit_action_dir = join_paths(path_datadir, 'polkit-1', 'actions')
|
path_polkit_dir = join_paths(path_datadir, 'polkit-1')
|
||||||
|
path_polkit_action_dir = join_paths(path_polkit_dir, 'actions')
|
||||||
|
path_polkit_rule_dir = join_paths(path_polkit_dir, 'rules.d')
|
||||||
|
|
||||||
with_examples = get_option('with-examples')
|
with_examples = get_option('with-examples')
|
||||||
with_util = get_option('with-util')
|
with_util = get_option('with-util')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user