[gnome-session/benzea/systemd-touch-stable-flag: 4/4] data: Permit checking gnome-session-stable during shutdown
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session/benzea/systemd-touch-stable-flag: 4/4] data: Permit checking gnome-session-stable during shutdown
- Date: Mon, 25 Nov 2019 15:35:47 +0000 (UTC)
commit ad663d07c8999ba2297d3c14c0c2b22b92aea0e8
Author: Benjamin Berg <bberg redhat com>
Date: Mon Nov 25 15:10:21 2019 +0100
data: Permit checking gnome-session-stable during shutdown
gnome-shell tries to disable extensions after a failure, but only if the
session is crashing in the first two minutes. Unfortunately, this test
needs to be able to run at the same time as
gnome-session-shutdown.target startup, as both session shutdown and
extension disabling is part of the OnFailure action.
To make this work, allow testing for the existance of the
gnome-session-stable file in the runtime directory. This file is only
removed after gnome-session-shutdown.target is reached, which means
gnome-shell can use it in a ConditionPathExists as long as it also adds
Before=gnome-session-shutdown.target.
See #43
data/gnome-session-shutdown.target | 5 +++++
data/gnome-session-stable-delete.service.in | 11 +++++++++++
data/gnome-session-stable.service.in | 10 ++++++++++
data/gnome-session-stable.target | 2 ++
data/meson.build | 4 +++-
5 files changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/data/gnome-session-shutdown.target b/data/gnome-session-shutdown.target
index 607dc6e7..2be8b7a8 100644
--- a/data/gnome-session-shutdown.target
+++ b/data/gnome-session-shutdown.target
@@ -30,3 +30,8 @@ StopWhenUnneeded=true
# Historic bug: https://bugzilla.gnome.org/show_bug.cgi?id=764029
Wants=gnome-session-restart-dbus.service
Before=gnome-session-restart-dbus.service
+
+# We also delete the gnome-session-stable file in the runtime directory.
+# Make sure gnome-session-shutdown is reached first though.
+Wants=gnome-session-stable-delete.service
+Before=gnome-session-stable-delete.service
diff --git a/data/gnome-session-stable-delete.service.in b/data/gnome-session-stable-delete.service.in
new file mode 100644
index 00000000..798d80ba
--- /dev/null
+++ b/data/gnome-session-stable-delete.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Remove gnome-session-stable flag from runtime directory
+# Note this is created from gnome-session-stable.target
+
+# Allow exit.target to start even if this unit is started with replace-irreversibly
+# Also put it into a slice that doesn't have such implicit dependencies
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+ExecStart=rm -f %t/gnome-session-stable
diff --git a/data/gnome-session-stable.service.in b/data/gnome-session-stable.service.in
new file mode 100644
index 00000000..208e8446
--- /dev/null
+++ b/data/gnome-session-stable.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Touch gnome-session-stable flag in runtime directory
+# Note that deletion happens from gnome-session-shutdown.target
+
+Requisite=gnome-session.target
+PartOf=gnome-session.target
+
+[Service]
+Type=oneshot
+ExecStart=touch %t/gnome-session-stable
diff --git a/data/gnome-session-stable.target b/data/gnome-session-stable.target
index 383cc3c6..6b5e78d1 100644
--- a/data/gnome-session-stable.target
+++ b/data/gnome-session-stable.target
@@ -3,3 +3,5 @@ Description=GNOME Session is stable (running for >2 minutes)
Requisite=gnome-session.target
PartOf=gnome-session.target
+
+Wants=gnome-session-stable.service
diff --git a/data/meson.build b/data/meson.build
index ef35c494..d94295f1 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -103,7 +103,9 @@ if enable_systemd_session
'gnome-session-signal-init.service',
'gnome-session-restart-dbus.service',
'gnome-session-monitor.service',
- 'gnome-session-failed.service']
+ 'gnome-session-failed.service',
+ 'gnome-session-stable.service',
+ 'gnome-session-stable-delete.service']
foreach service: systemd_service
configure_file(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]