d
This commit is contained in:
@@ -334,7 +334,13 @@ def install_service_systemd(
|
||||
workspace_root: Optional[Path] = None,
|
||||
) -> bool:
|
||||
try:
|
||||
print(f"Installing systemd user service via {Path(__file__).resolve()}...")
|
||||
helper_path = Path(__file__).resolve()
|
||||
print(f"Installing systemd user service via {helper_path}...")
|
||||
print("systemctl env:", {
|
||||
"DBUS_SESSION_BUS_ADDRESS": os.environ.get("DBUS_SESSION_BUS_ADDRESS"),
|
||||
"XDG_RUNTIME_DIR": os.environ.get("XDG_RUNTIME_DIR"),
|
||||
"HOME": os.environ.get("HOME"),
|
||||
})
|
||||
systemctl = shutil.which("systemctl")
|
||||
if not systemctl:
|
||||
print(
|
||||
@@ -350,6 +356,23 @@ def install_service_systemd(
|
||||
workspace_root=workspace_root
|
||||
)
|
||||
|
||||
if (
|
||||
not os.environ.get("DBUS_SESSION_BUS_ADDRESS")
|
||||
or not os.environ.get("XDG_RUNTIME_DIR")
|
||||
):
|
||||
print(
|
||||
"DBUS_SESSION_BUS_ADDRESS/XDG_RUNTIME_DIR not set; skipping systemd user install"
|
||||
)
|
||||
return install_service_cron(
|
||||
service_name,
|
||||
repo_root,
|
||||
venv_py,
|
||||
headless=headless,
|
||||
detached=detached,
|
||||
pull=pull,
|
||||
workspace_root=workspace_root,
|
||||
)
|
||||
|
||||
unit_dir = Path.home() / ".config" / "systemd" / "user"
|
||||
unit_dir.mkdir(parents=True, exist_ok=True)
|
||||
unit_file = unit_dir / f"{service_name}.service"
|
||||
|
||||
Reference in New Issue
Block a user