feat: allow using suite on non-nixos systems

This commit is contained in:
FUFSoB committed 2026-09-17 13:27:08 +05:00
1 parent e852bef400
commit 3b568bb54e
63 files changed
+3572 -523

No files matched your search

+6 -1
View File
@@ -94,9 +94,14 @@ def is_root():
return os.geteuid() == 0
def can_elevate():
"""Whether running as root would get further: not on a rootless host, where the user owns everything."""
return ctl.privileged() and not is_root()
def needs_root(out, status):
"""A failed run that root could do: the front ends offer to retry it elevated."""
return bool(status) and status > 0 and not is_root() and any(ROOT_HINT.search(line) for line in out)
return bool(status) and status > 0 and can_elevate() and any(ROOT_HINT.search(line) for line in out)
STATE_ICONS = {"active": "●", "inactive": "○", "failed": "✗", "activating": "◐", "deactivating": "◐", "reloading": "◐"}