Commit 9ed40c9
0
plików
+0
dodanych
-0
usuniętych
@@ -55,7 +55,7 @@ import threading, itertools
55 55 import uuid # serialNumber SBOM (CycloneDX)
56 56
57 57 # Wersja klienta – do porównania z repo.json["pag_version"] (self-update)
58 -PAG_VERSION = "4.0.6"
58 +PAG_VERSION = "4.0.7"
59 59 from urllib.error import URLError, HTTPError
60 60
61 61 # =============================================================================
@@ -3428,6 +3428,12 @@ DEFAULT_TRIGGERS = [
3428 3428 "run": "update-desktop-database -q /usr/share/applications"},
3429 3429 {"name": "mime-database", "paths": ["/usr/share/mime/"],
3430 3430 "run": "update-mime-database /usr/share/mime"},
3431 + {"name": "systemd-daemon-reload", "paths": ["/usr/lib/systemd/system/"],
3432 + "run": "systemctl daemon-reload"},
3433 + {"name": "systemd-user-daemon-reload", "paths": ["/usr/lib/systemd/user/"],
3434 + "run": "systemctl --global daemon-reload"},
3435 + {"name": "udev-reload", "paths": ["/usr/lib/udev/rules.d/"],
3436 + "run": "udevadm control --reload-rules"},
3431 3437 ]
3432 3438
3433 3439 def _load_triggers() -> List[dict]:
@@ -3453,6 +3459,49 @@ def _load_triggers() -> List[dict]:
3453 3459 out.append(t)
3454 3460 return out
3455 3461
3462 +def _reload_user_media_services(touched_paths: List[str]) -> None:
3463 + """Po aktualizacji multimediow przeladuj uslugi UZYTKOWNIKA (pipewire/wireplumber).
3464 +
3465 + Nowe binarki/moduly sa juz na dysku, ale dzialajace sesje maja stare w
3466 + pamieci i probuja ladowac nieistniejace wersje modulow. Best-effort:
3467 + `systemctl --global daemon-reload` + try-restart w kazdej aktywnej sesji.
3468 + """
3469 + if os.environ.get("PAG_NO_HOOKS", "") == "1":
3470 + return
3471 + _pfx = ("/usr/lib/systemd/user/pipewire", "/usr/lib/systemd/user/wireplumber",
3472 + "/usr/bin/pipewire", "/usr/bin/wireplumber",
3473 + "/usr/lib/pipewire-0.3/", "/usr/lib64/pipewire-0.3/",
3474 + "/usr/lib/wireplumber-0.5/", "/usr/lib64/wireplumber-0.5/")
3475 + if not any(_p.startswith(_x) for _x in _pfx for _p in touched_paths):
3476 + return
3477 + try:
3478 + subprocess.run(["systemctl", "--global", "daemon-reload"],
3479 + capture_output=True, timeout=60)
3480 + except Exception:
3481 + pass
3482 + try:
3483 + _r = subprocess.run(["loginctl", "list-users", "--no-legend"],
3484 + capture_output=True, text=True, timeout=30)
3485 + _users = [ln.split()[1] for ln in (_r.stdout or "").splitlines()
3486 + if len(ln.split()) >= 2]
3487 + except Exception:
3488 + _users = []
3489 + _done = []
3490 + for _u in _users:
3491 + try:
3492 + _rr = subprocess.run(
3493 + ["su", "-", _u, "-c",
3494 + "systemctl --user try-restart pipewire.socket pipewire.service "
3495 + "wireplumber.service"],
3496 + capture_output=True, timeout=60)
3497 + if _rr.returncode == 0:
3498 + _done.append(_u)
3499 + except Exception:
3500 + pass
3501 + if _done:
3502 + print(" \u26a1 przeladowano uslugi audio dla sesji: "
3503 + + ", ".join(sorted(set(_done))))
3504 +
3456 3505 def _process_triggers(touched_paths: List[str]):
3457 3506 """Uruchamia pasujące triggery RAZ na końcu transakcji (best-effort)."""
3458 3507 if not touched_paths:
@@ -3477,6 +3526,8 @@ def _process_triggers(touched_paths: List[str]):
3477 3526 _audit(f"TRIGGER {trig['name']} TIMEOUT")
3478 3527 except Exception as e:
3479 3528 print(f" ⚠ trigger {trig['name']}: {e}")
3529 + _reload_user_media_services(touched_paths)
3530 +
3480 3531
3481 3532 # =============================================================================
3482 3533 # UPDATE / UPGRADE / LIST / SEARCH / INFO / VERIFY