feat(reboot): wire automated and interactive system reboot on update and release-upgrade

This commit is contained in:
soda64 committed 2026-10-02 18:39:41 +02:00
1 parent 61875621ed
commit 426e8e5b6e
4 files changed
+320 -26

No files matched your search

+11 -11
View File
@@ -388,17 +388,17 @@ class DnfManager(PackageManager):
return self.runner.run(cmd)
def is_reboot_required(self) -> RebootStatus:
# Check if dnf system-upgrade downloaded packages are staged
system_upgrade_dir = Path("/var/lib/dnf/system-upgrade")
if system_upgrade_dir.exists():
try:
if any(system_upgrade_dir.iterdir()):
return RebootStatus(
required=True,
reason="System upgrade packages downloaded. Run: 'sudo dnf system-upgrade reboot' to perform the upgrade.",
)
except Exception:
pass
# Check if dnf / dnf5 system-upgrade downloaded packages are staged
for upgrade_path in [Path("/var/lib/dnf/system-upgrade"), Path("/var/lib/dnf5/offline")]:
if upgrade_path.exists():
try:
if any(upgrade_path.iterdir()):
return RebootStatus(
required=True,
reason="System upgrade packages downloaded. Run: 'sudo dnf system-upgrade reboot' to perform the upgrade.",
)
except Exception:
pass
# Check needs-restarting -r
if shutil.which("needs-restarting"):
res = self.runner.run(["needs-restarting", "-r"])