data: Use ConditionEnvironment on unit files

Following GNOME/gnome-shell!1472. It's been almost three years since
ConditionEnvironment was available.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2791>
This commit is contained in:
Joan Torres 2023-06-07 09:59:25 +02:00
parent dec26b7da2
commit c5018c2fe7
2 changed files with 6 additions and 10 deletions

View File

@ -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

View File

@ -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