[gnome-shell/benzea/systemd-clean-shutdown-with-extension-disabling] data: Enable clean session shutdown after gnome-shell failure



commit 4a4f9fbe9f8fc44e12800b1df3ed5f7008741015
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Nov 25 15:15:01 2019 +0100

    data: Enable clean session shutdown after gnome-shell failure
    
    If the GNOME shell crashes, we run a service that may disable
    extensions. This is important so that users will not be locked out of
    their own session in case an extension is causing crashes.
    
    As this is a very agressive action, we only do so if the session fails
    in the first two minutes. The logic to do so was broken though, and
    would result in an unclean session shutdown.
    
    Fix this by using the newly introduced file %t/gnome-session-stable and
    using a ConditionPathExists. This avoids any depenencies and therefore
    can cleanly run in parallel to a normal session shutdown.
    
    Note that it is not a regression to do this even if the gnome-session
    part is not yet installed on the system. The result will be to always
    disable the extensions rather than just in the first two minutes.
    
    However, due to a bug in the old logic, this was happening anyway.
    
    See
      https://gitlab.gnome.org/GNOME/gnome-session/issues/43
      https://gitlab.gnome.org/GNOME/gnome-session/merge_requests/31
    for a log of the bug happening and the gnome-session part to fix this.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/858

 data/gnome-shell-disable-extensions.service | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/data/gnome-shell-disable-extensions.service b/data/gnome-shell-disable-extensions.service
index d55d7ed879..b1345ecb07 100644
--- a/data/gnome-shell-disable-extensions.service
+++ b/data/gnome-shell-disable-extensions.service
@@ -1,14 +1,17 @@
 [Unit]
 Description=Disable GNOME Shell extensions after failure
+# Note that this unit must not conflict with anything, and must
+# be able to run in parallel with the gnome-session-shutdown.target.
 DefaultDependencies=no
 
-# Only disable extensions for a short period of time after login.
-# This means we err on the side of failing the first login after a broken
-# extension was installed.
-Requisite=gnome-session-stable.timer
+# We want to disable extensions only in the first two minutes of the session.
+# To do so, we can check that the gnome-session-stable file does not exist,
+# as long as we do so before gnome-session-shutdown.target is reached as that
+# will delete it again.
+Before=gnome-session-shutdown.target
+ConditionPathExists=!%t/gnome-session-stable
 
 [Service]
 Type=simple
-# Disable extensions
 ExecStart=gsettings set org.gnome.shell disable-user-extensions true
 Restart=no


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]