Documentation
¶
Index ¶
- Variables
- func ReadFileAsRoot(ctx context.Context, fn string, allowPrompt bool) ([]byte, error)
- func RemoveFileAsRoot(ctx context.Context, fn string) error
- func RenameFileAsRoot(ctx context.Context, oldFn, newFn string) error
- func StartDaemon(ctx context.Context, name string, path string, args []string, ...) error
- func SudoReader(ctx context.Context, fn string, allowPrompt bool) (*sudoReader, error)
- func SudoReaderIfNecessary(ctx context.Context, fn string, allowPrompt bool) (io.ReadCloser, error)
- func SystemdUserConn(ctx context.Context) (_ *dbus.Conn, finalErr error)
- func WriteFileAsRoot(ctx context.Context, fn string, content io.Reader, mode os.FileMode) error
- type Isolator
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrWrongNamespace = fmt.Errorf("systemd instance is in a different namespace")
)
in some container environments we may be able to talk to the "host" systemd user instance, but we don't want to _use_ it in that case because it won't see our paths/etc.
View Source
var GetIsolator func() (Isolator, error)
GetIsolator is initialized in platform-specific files, and should generally be the result of sync.OnceValues.
Functions ¶
func ReadFileAsRoot ¶
func RenameFileAsRoot ¶ added in v0.7.0
func StartDaemon ¶
func SudoReader ¶
func SudoReaderIfNecessary ¶
func SystemdUserConn ¶ added in v0.9.0
SystemdUserConn wraps dbus.NewUserConnectionContext but verifies that the connection is to a systemd instance in the same namespace.
If the systemd instance is in a different namespace, or it runs into errors attemping the verification, then it will return an error wrapping ErrWrongNamespace.
Types ¶
Click to show internal directories.
Click to hide internal directories.