Fix: OS-Update-Erkennung auf deutscher Box (LC_ALL=C fuer apt)
_os_upgradable zaehlte mit `grep -c upgradable`, os_update_details parste `[upgradable from:]` — beides englisch. Auf der deutschsprachigen Box gibt apt aber `[aktualisierbar von:]` aus → Zaehler 0 und leere Detailliste, obwohl `apt list --upgradable` 7 Pakete zeigt. Fix: apt mit LC_ALL=C aufrufen, dann ist die Ausgabe immer englisch und beide greifen wieder. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -66,8 +66,10 @@ def _ram_gb() -> float:
|
||||
|
||||
def _os_upgradable() -> int:
|
||||
try:
|
||||
# LC_ALL=C erzwingt englische apt-Ausgabe ("[upgradable from: ...]") — sonst zählt
|
||||
# grep auf einer deutschen Box ("[aktualisierbar von:]") nichts und meldet faelschlich 0.
|
||||
out = subprocess.run(
|
||||
["bash", "-c", "apt list --upgradable 2>/dev/null | grep -c upgradable || true"],
|
||||
["bash", "-c", "LC_ALL=C apt list --upgradable 2>/dev/null | grep -c upgradable || true"],
|
||||
capture_output=True, text=True, timeout=10)
|
||||
return int((out.stdout or "0").strip() or 0)
|
||||
except Exception:
|
||||
@@ -296,7 +298,9 @@ def os_update_details() -> dict:
|
||||
"""Liste der aktualisierbaren apt-Pakete (Name, installiert → Kandidat)."""
|
||||
out_pkgs: list[dict] = []
|
||||
try:
|
||||
out = subprocess.run(["bash", "-c", "apt list --upgradable 2>/dev/null"],
|
||||
# LC_ALL=C → englische Ausgabe, damit der Regex "[upgradable from: ...]" greift
|
||||
# (deutsche Box meldet sonst "[aktualisierbar von:]" und die Liste bliebe leer).
|
||||
out = subprocess.run(["bash", "-c", "LC_ALL=C apt list --upgradable 2>/dev/null"],
|
||||
capture_output=True, text=True, timeout=20)
|
||||
for line in (out.stdout or "").splitlines():
|
||||
# Format: name/repo neue_version arch [upgradable from: alte_version]
|
||||
|
||||
Reference in New Issue
Block a user