[gnome-shell/benzea/systemd-3.36-units] data: Add an abstract gnome-shell.target



commit 69c648d55f1e9d77543806b264c524c2ee1b18e3
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Dec 10 16:23:43 2019 +0100

    data: Add an abstract gnome-shell.target
    
    Add a gnome-shell.target to simplify pulling in the GNOME shell into the
    ssession. Also, the intermediate targets are not very helpful after all.
    We can instead use "Conflicts" (but not "Requires") to ensure the right
    service is loaded on wayland/X11.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/895

 data/gnome-shell-wayland.service.in |  7 ++++---
 data/gnome-shell-wayland.target     | 10 ----------
 data/gnome-shell-x11.service.in     |  8 +++++---
 data/gnome-shell-x11.target         | 10 ----------
 data/gnome-shell.target             | 18 ++++++++++++++++++
 data/meson.build                    |  3 +--
 6 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/data/gnome-shell-wayland.service.in b/data/gnome-shell-wayland.service.in
index 04f94af2d6..b383b5d50f 100644
--- a/data/gnome-shell-wayland.service.in
+++ b/data/gnome-shell-wayland.service.in
@@ -13,11 +13,12 @@ Requisite=gnome-session-initialized.target
 PartOf=gnome-session-initialized.target
 Before=gnome-session-initialized.target
 
-# The units already conflict because they use the same BusName
-#Conflicts=gnome-shell-x11.service
-
 [Service]
 Type=notify
+# We cannot use Requisite= because that does not work with OnFailure, and we
+# cannot use Conflicts= because that would stop gnome-session-x11.target
+# if gnome-shell needs to be restarted.
+ExecCondition=systemctl --user --quiet is-active gnome-session-wayland.target
 ExecStart=@bindir@/gnome-shell
 # Exit code 1 means we are probably *not* dealing with an extension failure
 SuccessExitStatus=1
diff --git a/data/gnome-shell-x11.service.in b/data/gnome-shell-x11.service.in
index a10c33d29d..6daf464190 100644
--- a/data/gnome-shell-x11.service.in
+++ b/data/gnome-shell-x11.service.in
@@ -13,15 +13,17 @@ Requisite=gnome-session-initialized.target
 PartOf=gnome-session-initialized.target
 Before=gnome-session-initialized.target
 
-# The units already conflict because they use the same BusName
-#Conflicts=gnome-shell-wayland.service
-
 # Limit startup frequency more than the default
 StartLimitIntervalSec=15s
 StartLimitBurst=3
 
 [Service]
 Type=notify
+# Do not load in wayland session.
+# We cannot use Requisite= because that does not work with OnFailure, and we
+# cannot use Conflicts= because that would stop gnome-session-wayland.target
+# if gnome-shell needs to be restarted.
+ExecCondition=systemctl --user --quiet is-active gnome-session-x11.target
 ExecStart=@bindir@/gnome-shell
 # Exit code 1 means we are probably *not* dealing with an extension failure
 SuccessExitStatus=1
diff --git a/data/gnome-shell.target b/data/gnome-shell.target
new file mode 100644
index 0000000000..d1f69ada4a
--- /dev/null
+++ b/data/gnome-shell.target
@@ -0,0 +1,18 @@
+[Unit]
+Description=GNOME Shell
+DefaultDependencies=no
+CollectMode=inactive-or-failed
+
+Requisite=gnome-session-initialized.target
+PartOf=gnome-session-initialized.target
+Before=gnome-session-initialized.target
+
+# Pull in both x11 and wayland, one of them will fail due to dependencies.
+Wants=gnome-shell-wayland.service
+Wants=gnome-shell-x11.service
+
+PartOf=gnome-shell-wayland.service
+PartOf=gnome-shell-x11.service
+
+After=gnome-shell-wayland.service
+After=gnome-shell-x11.service
diff --git a/data/meson.build b/data/meson.build
index 88a61765f5..acd0af1f56 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -114,8 +114,7 @@ if have_systemd
     install_dir: systemduserunitdir
   )
 
-  units = files('gnome-shell-x11.target',
-                'gnome-shell-wayland.target',
+  units = files('gnome-shell.target',
                 'gnome-shell-disable-extensions.service')
 
   install_data(units, install_dir: systemduserunitdir)


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