Skip to content

Commit

Permalink
allow systemd-run with Ubuntu >= 22
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Dec 28, 2023
1 parent 30cae49 commit b701bf2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
WIN32, OSX, POSIX
)
from xpra.util.io import is_socket, stderr_print, use_tty
from xpra.util.system import is_Wayland, is_Ubuntu, SIGNAMES, set_proc_title, is_systemd_pid1
from xpra.util.system import (
is_Wayland, is_Ubuntu, SIGNAMES,
set_proc_title, is_systemd_pid1, get_distribution_version_id,
)
from xpra.scripts.parsing import (
info, warn, error,
get_usage,
Expand Down Expand Up @@ -365,9 +368,19 @@ def use_systemd_run(s) -> bool:
if systemd_run in (True, False):
return systemd_run
# detect if we should use it:
if is_Ubuntu() and (os.environ.get("SSH_TTY") or os.environ.get("SSH_CLIENT")): # pragma: no cover
if os.environ.get("SSH_TTY") or os.environ.get("SSH_CLIENT"): # pragma: no cover
# would fail
return False
if is_Ubuntu():
try:
# Ubuntu was broken up until 21.10:
# https://github.com/systemd/systemd/issues/3388
rel = float(get_distribution_version_id())
if rel < 22:
return False
except ValueError:
pass
# would fail
if not is_systemd_pid1():
return False # pragma: no cover
# test it:
Expand Down

0 comments on commit b701bf2

Please sign in to comment.