Skip to main content

linux_elevation

Function linux_elevation 

Source
pub fn linux_elevation() -> Elevation
Expand description

Decide how to invoke kopia on Linux given the current user and whether the system kopia install is present (and accessible).

Logic:

  • If we’re the kopia user, run directly.
  • Else, probe the system kopia config:
    • Not found (ENOENT): no system install. Run directly as current user; they’re presumably running their own kopia under their own config.
    • Permission denied (EACCES): exists, owned by kopia user. Elevate via sudo -u kopia.
    • Readable: exists and we can read it (unusual mode). Run directly.