From c5018c2fe7e66f9e7a664d31afd34323a1fd1a14 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Wed, 7 Jun 2023 09:59:25 +0200 Subject: [PATCH] data: Use ConditionEnvironment on unit files Following GNOME/gnome-shell!1472. It's been almost three years since ConditionEnvironment was available. Part-of: --- data/org.gnome.Shell@wayland.service.in | 8 +++----- data/org.gnome.Shell@x11.service.in | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/data/org.gnome.Shell@wayland.service.in b/data/org.gnome.Shell@wayland.service.in index 76d5ccb1b..a1980e8a5 100644 --- a/data/org.gnome.Shell@wayland.service.in +++ b/data/org.gnome.Shell@wayland.service.in @@ -13,14 +13,12 @@ Requisite=gnome-session-initialized.target PartOf=gnome-session-initialized.target Before=gnome-session-initialized.target +#NOTE: ConditionEnvironment works with systemd >= 246 +ConditionEnvironment=XDG_SESSION_TYPE=%I + [Service] Slice=session.slice Type=notify -# NOTE: This can be replaced with ConditionEnvironment=XDG_SESSION_TYPE=%I in -# the [Unit] section with systemd >= 246. Also, the current solution is -# kind of painful as systemd had a bug where it retries the condition. -# Only start if the template instance matches the session type. -ExecCondition=/bin/sh -c 'test "$XDG_SESSION_TYPE" = "%I" || exit 2' ExecStart=@bindir@/gnome-shell # Exit code 1 means we are probably *not* dealing with an extension failure SuccessExitStatus=1 diff --git a/data/org.gnome.Shell@x11.service.in b/data/org.gnome.Shell@x11.service.in index 078d87a3c..e5785b453 100644 --- a/data/org.gnome.Shell@x11.service.in +++ b/data/org.gnome.Shell@x11.service.in @@ -13,6 +13,9 @@ Requisite=gnome-session-initialized.target PartOf=gnome-session-initialized.target Before=gnome-session-initialized.target +#NOTE: ConditionEnvironment works with systemd >= 246 +ConditionEnvironment=XDG_SESSION_TYPE=%I + # Limit startup frequency more than the default StartLimitIntervalSec=15s StartLimitBurst=3 @@ -20,11 +23,6 @@ StartLimitBurst=3 [Service] Slice=session.slice Type=notify -# NOTE: This can be replaced with ConditionEnvironment=XDG_SESSION_TYPE=%I in -# the [Unit] section with systemd >= 246. Also, the current solution is -# kind of painful as systemd had a bug where it retries the condition. -# Only start if the template instance matches the session type. -ExecCondition=/bin/sh -c 'test "$XDG_SESSION_TYPE" = "%I" || exit 2' ExecStart=@bindir@/gnome-shell # Exit code 1 means we are probably *not* dealing with an extension failure SuccessExitStatus=1