Compare commits

...

No commits in common. "imports/c8s/gnome-settings-daemon-3.32.0-14.el8" and "c8" have entirely different histories.

7 changed files with 1262 additions and 5 deletions

View File

@ -0,0 +1,47 @@
From bd0488fe501bae74fae1fbb21566aa35f38aa6fc Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Wed, 15 Feb 2023 15:27:59 +0100
Subject: [PATCH] Make power-button-action always power off when chassis=server
Servers often don't support hibernation/suspend.
---
...rg.gnome.settings-daemon.plugins.power.gschema.xml.in | 2 +-
plugins/media-keys/gsd-media-keys-manager.c | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
index fc61d133..952104ed 100644
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
@@ -39,7 +39,7 @@
<key name="power-button-action" enum="org.gnome.settings-daemon.GsdPowerButtonActionType">
<default>'suspend'</default>
<summary>Power button action</summary>
- <description>The action to take when the system power button is pressed. Virtual machines only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
+ <description>The action to take when the system power button is pressed. Virtual machines and servers only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
</key>
</schema>
</schemalist>
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index ac6f7ab4..46bdade6 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -2083,9 +2083,12 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
if (manager->priv->power_button_disabled)
return;
- action_type = g_settings_get_enum (manager->priv->power_settings, "power-button-action");
- /* Always power off VMs, except when power-button-action is "nothing" */
- if (g_strcmp0 (manager->priv->chassis_type, "vm") == 0) {
+ action_type = g_settings_get_enum (manager->priv->power_settings, "power-button-action");
+ /* Always power off VMs and servers, except when power-button-action is "nothing" */
+ if (g_strcmp0 (manager->priv->chassis_type, "vm") == 0 ||
+ g_strcmp0 (manager->priv->chassis_type, "server")) {
+ g_warning ("Virtual machines and servers only honor the 'nothing' power-button-action, and will shutdown otherwise");
+
if (action_type != GSD_POWER_BUTTON_ACTION_NOTHING)
power_action (manager, "PowerOff", !in_lock_screen);
--
2.37.1

View File

@ -0,0 +1,34 @@
From 77b52a04c9154a7e7b2434f6c70ba6b4fd84c9f1 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 15 Oct 2020 15:18:35 +0200
Subject: [PATCH] power: Avoid automatic logout in GDM/greeter
In GDM sessions (greeter, initial-setup), it does not make sense to
automatically logout. This can happen if the system wide default is
changed to default to the "logout" action.
Note that we already use the RUNNING_UNDER_GDM environment variable in
the keyboard plugin currently. So doing this is likely sane, even if we
probably want a more elegant strategy to detect whether we are in a
"login" session.
---
plugins/power/gsd-power-manager.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index e103a8a7..b100ff9e 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -872,6 +872,9 @@ static void
gnome_session_logout (GsdPowerManager *manager,
guint logout_mode)
{
+ if (g_getenv("RUNNING_UNDER_GDM"))
+ return;
+
g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->session),
"Logout",
g_variant_new ("(u)", logout_mode),
--
2.26.2

View File

@ -0,0 +1,53 @@
From fbe9b7dba44cb284f649a1e916b2cf3ce8281211 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Tue, 7 May 2019 15:40:20 +0200
Subject: [PATCH] power: Only disable Suspend/Hibernate actions inside VM
While we theoretically only want a different default value inside a VM,
we currently hack this by never doing a suspend action inside VMs.
However, that also breaks automatic logout, which is an unintended side
effect.
Move the check to not install the corresponding timeout (preventing
sleep warnings from being displayed) and also only enforce the VM
specific hack for the Suspend and Hibernate actions.
---
plugins/power/gsd-power-manager.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index f965f6f..dbaa262 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1520,13 +1520,6 @@ idle_set_mode (GsdPowerManager *manager, GsdPowerIdleMode mode)
return;
}
- /* don't do any power saving if we're a VM */
- if (manager->priv->is_virtual_machine) {
- g_debug ("ignoring state transition to %s as virtual machine",
- idle_mode_to_string (mode));
- return;
- }
-
manager->priv->current_idle_mode = mode;
g_debug ("Doing a state transition: %s", idle_mode_to_string (mode));
@@ -1727,6 +1720,14 @@ idle_configure (GsdPowerManager *manager)
clear_idle_watch (manager->priv->idle_monitor,
&manager->priv->idle_sleep_warning_id);
+ /* don't do any power saving if we're a VM */
+ if (manager->priv->is_virtual_machine &&
+ (action_type == GSD_POWER_ACTION_SUSPEND ||
+ action_type == GSD_POWER_ACTION_HIBERNATE)) {
+ g_debug ("Ignoring sleep timeout with suspend action inside VM");
+ timeout_sleep = 0;
+ }
+
if (timeout_sleep != 0) {
g_debug ("setting up sleep callback %is", timeout_sleep);
--
2.31.1

View File

@ -0,0 +1,59 @@
From 0e2c4aec104b65d2f8ea7167269e91c303908a6f Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Wed, 4 Jan 2023 15:30:15 +0100
Subject: [PATCH] power: Respect the "nothing" power-button-action for VMs
There are use-cases when one wants to forcefully make the guest ignore
poweroff requests from the hypervisor.
See https://bugzilla.redhat.com/2062051
See also https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/46
---
...org.gnome.settings-daemon.plugins.power.gschema.xml.in | 2 +-
plugins/media-keys/gsd-media-keys-manager.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
index 93c704e9..fc61d133 100644
--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
+++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in
@@ -39,7 +39,7 @@
<key name="power-button-action" enum="org.gnome.settings-daemon.GsdPowerButtonActionType">
<default>'suspend'</default>
<summary>Power button action</summary>
- <description>The action to take when the system power button is pressed. This action is hard-coded (and the setting ignored) on virtual machines (power off) and tablets (suspend).</description>
+ <description>The action to take when the system power button is pressed. Virtual machines only honor the 'nothing' action, and will shutdown otherwise. Tablets always suspend, ignoring all the other action options.</description>
</key>
</schema>
</schemalist>
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index a526d5cf..ac6f7ab4 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -2083,9 +2083,12 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
if (manager->priv->power_button_disabled)
return;
- /* Always power off VMs when power off is pressed in the menus */
+ action_type = g_settings_get_enum (manager->priv->power_settings, "power-button-action");
+ /* Always power off VMs, except when power-button-action is "nothing" */
if (g_strcmp0 (manager->priv->chassis_type, "vm") == 0) {
- power_action (manager, "PowerOff", !in_lock_screen);
+ if (action_type != GSD_POWER_BUTTON_ACTION_NOTHING)
+ power_action (manager, "PowerOff", !in_lock_screen);
+
return;
}
@@ -2095,7 +2098,6 @@ do_config_power_button_action (GsdMediaKeysManager *manager,
return;
}
- action_type = g_settings_get_enum (manager->priv->power_settings, "power-button-action");
switch (action_type) {
case GSD_POWER_BUTTON_ACTION_SUSPEND:
action = GSD_POWER_ACTION_SUSPEND;
--
2.37.1

View File

@ -0,0 +1,49 @@
From f2cd5fb30892e3868732fca1d38fc15fdb73ec18 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Tue, 27 Oct 2020 10:20:34 +0100
Subject: [PATCH 2/2] power: Never register sleep timeout for logout in GDM
We already suppress logout actions in GDM (10aa1714b05b, power: Avoid
automatic logout in GDM/greeter). However, while this prevents the
action, we may still warn.
Change it so that the corresponding timeouts will never be registered.
Leave the guard in gnome_session_logout but add a warning as we should
never be hitting that code path.
---
plugins/power/gsd-power-manager.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 9f2e858e..ed855b6b 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -872,8 +872,10 @@ static void
gnome_session_logout (GsdPowerManager *manager,
guint logout_mode)
{
- if (g_getenv("RUNNING_UNDER_GDM"))
+ if (g_getenv ("RUNNING_UNDER_GDM")) {
+ g_warning ("Prevented logout from GDM session! This indicates an issue in gsd-power.");
return;
+ }
g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->session),
"Logout",
@@ -1773,6 +1775,13 @@ idle_configure (GsdPowerManager *manager)
timeout_sleep = 0;
}
+ /* don't do any automatic logout if we are in GDM */
+ if (g_getenv ("RUNNING_UNDER_GDM") &&
+ (action_type == GSD_POWER_ACTION_LOGOUT)) {
+ g_debug ("Ignoring sleep timeout with logout action inside GDM");
+ timeout_sleep = 0;
+ }
+
if (timeout_sleep != 0) {
g_debug ("setting up sleep callback %is", timeout_sleep);
--
2.26.2

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
Name: gnome-settings-daemon
Version: 3.32.0
Release: 14%{?dist}
Release: 19%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
License: GPLv2+
@ -118,6 +118,15 @@ Patch50016: 0016-subman-Update-POTFILES.in.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1876291
Patch50017: 0017-Update-translations.patch
Patch60001: 0001-power-Only-disable-Suspend-Hibernate-actions-inside-.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2062051
Patch70001: 0001-power-Respect-the-nothing-power-button-action-for-VM.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2018606
Patch70002: 0001-power-Avoid-automatic-logout-in-GDM-greeter.patch
Patch70003: 0002-power-Never-register-sleep-timeout-for-logout-in-GDM.patch
Patch70004: 0001-Make-power-button-action-always-power-off-when-chass.patch
%description
A daemon to share settings from GNOME to other applications. It also
handles global keybindings, as well as a number of desktop-wide settings.
@ -248,6 +257,26 @@ mkdir $RPM_BUILD_ROOT%{_libdir}/gnome-settings-daemon-3.0/gtk-modules
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Fri Feb 17 2023 Felipe Borges <feborges@redhat.com> - 4.32.0-19
- Make power-button-action default to poweroff on servers
- Resolves: #1920829
* Tue Jan 24 2023 Felipe Borges <feborges@redhat.com> - 3.32.0-18
- Prevent automatic logout warning in greeter sessions
- Resolves: #2018606
* Wed Jan 04 2023 Felipe Borges <feborges@redhat.com> - 3.32.0-17
- Make power-button-action respect the "nothing" action on VMs
- Resolves: #2062051
* Fri Sep 10 2021 Kalev Lember <klember@redhat.com> - 3.32.0-16
- Update pt_BR translations
- Resolves: #2003069
* Fri Aug 06 2021 Carlos Garnacho <cgarnach@redhat.com> - 3.32.0-15
- Keep auto-logout working inside VMs
Resolves: #1904139
* Mon Mar 01 2021 Kalev Lember <klember@redhat.com> - 3.32.0-14
- Update fr, ja, zh_CN translations
- Resolves: #1876291