PaganOS Luna 0.6.0
PL EN DE
← pag

Commit f821c52

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.4"
58 +PAG_VERSION = "4.0.5"
59 59 from urllib.error import URLError, HTTPError
60 60
61 61 # =============================================================================
@@ -3282,7 +3282,7 @@ def cmd_install(package_names, as_dep=False, upgrade=False):
3282 3282 # Jądro zmienione na ZWYKŁEJ instalacji → odśwież GRUB (hook pakietu
3283 3283 # nie może: trzymany lock PAG-a). Bez tego menu zostaje przy starym jądrze.
3284 3284 if any(_is_kernel_package(_n) for _n in to_install):
3285 - _refresh_bootloader()
3285 + _post_kernel_hooks()
3286 3286
3287 3287 print(f"\n✅ {_('installed', len(to_install))} ({(time.time()-t0):.0f}s)")
3288 3288 return 0
@@ -3998,7 +3998,7 @@ def cmd_update(do_upgrade: bool = False):
3998 3998 pass
3999 3999
4000 4000 # Raport: pakiety do aktualizacji
4001 - pending = _pending_updates()
4001 + pending = _kernel_group_updates(_pending_updates())
4002 4002 if not pending:
4003 4003 print(f"✅ {_('all_up_to_date')}")
4004 4004 _base_hint_unmanaged()
@@ -5202,6 +5202,48 @@ def _is_kernel_package(name: str) -> bool:
5202 5202 name_lower = name.lower()
5203 5203 return any(pattern in name_lower for pattern in KERNEL_PACKAGE_PATTERNS)
5204 5204
5205 +# Towarzysze jądra – aktualizowani RAZEM z jądrem, jeśli są zainstalowani,
5206 +# żeby userspace i moduły jądra nie rozjechały się wersjami.
5207 +KERNEL_SIBLINGS = ("linux-headers", "nvidia-dkms", "nvidia-kernel", "dkms",
5208 + "virtualbox-host-modules", "virtualbox-guest-modules")
5209 +
5210 +
5211 +def _kernel_group_updates(pending):
5212 + """Gdy w transakcji jest jądro, dołóż jego towarzyszy (jeśli zainstalowani)."""
5213 + if not any(_is_kernel_package(n) for n in pending):
5214 + return pending
5215 + try:
5216 + installed = load_json(INSTALLED_DB)
5217 + repo = fetch_all_packages()
5218 + except Exception:
5219 + return pending
5220 + out = list(pending)
5221 + for sib in KERNEL_SIBLINGS:
5222 + if sib in installed and sib in repo and sib not in out:
5223 + out.append(sib)
5224 + return out
5225 +
5226 +
5227 +def _post_kernel_hooks():
5228 + """Po zmianie jądra na ZWYKŁEJ instalacji: initramfs + DKMS + GRUB.
5229 +
5230 + Kolejność ma znaczenie: najpierw initramfs dla nowego jądra, potem moduły
5231 + out-of-tree (DKMS) pod to samo jądro, na końcu wpisy GRUB. Bez tego
5232 + aktualizacja jądra zostawia system z „nowymi modułami na starym jądrze”.
5233 + """
5234 + try:
5235 + _rebuild_initramfs()
5236 + except Exception:
5237 + pass
5238 + if shutil.which("dkms"):
5239 + try:
5240 + print(" 🔧 DKMS: przebudowa modułów out-of-tree (nvidia/vbox)...")
5241 + subprocess.run(["dkms", "autoinstall"],
5242 + capture_output=True, text=True, timeout=1800)
5243 + except Exception:
5244 + pass
5245 + _refresh_bootloader()
5246 +
5205 5247 def _rebuild_initramfs(deploy_dir: str = "") -> bool:
5206 5248 """
5207 5249 Przebudowuje initramfs dla aktywnego (lub podanego) deploymentu.
@@ -5213,6 +5255,17 @@ def _rebuild_initramfs(deploy_dir: str = "") -> bool:
5213 5255 root = _get_deployment_root()
5214 5256
5215 5257 if root == PAG_ROOT:
5258 + # Zwykły system – NAJPIERW natywne narzędzie PaganOS (per-wersja +
5259 + # root=UUID/PARTUUID/LABEL), potem dracut/mkinitcpio.
5260 + if shutil.which("pagan-initramfs"):
5261 + print(" 🔧 Przebudowa initramfs (pagan-initramfs)...")
5262 + try:
5263 + r = subprocess.run(["pagan-initramfs"], capture_output=True,
5264 + text=True, timeout=600)
5265 + if r.returncode == 0:
5266 + return True
5267 + except Exception:
5268 + pass
5216 5269 # Zwykły system – użyj dracut jeśli dostępny
5217 5270 if shutil.which("dracut"):
5218 5271 print(" 🔧 Przebudowa initramfs (dracut)...")