Documentation
¶
Overview ¶
Package cli gives a host program ota's commands as subcommands of its own binary, so updating never needs a second program:
switch os.Args[1] {
case "update", "run", "offer":
os.Exit(cli.Commands(config)[os.Args[1]](os.Args[2:]))
}
Index ¶
Constants ¶
const ( ExitOK = 0 ExitError = 1 ExitDeferred = 10 ExitDrainTimeout = 11 ExitRefused = 20 ExitDownload = 30 ExitRolledBack = 40 ExitLocked = 50 ExitRestartNeeded = 60 )
Exit codes. Stable, so schedulers and scripts can branch on them.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Client configures the updater for this program. Restarter is ignored by
// `update`, which always hands off (see restart.HandOff).
Client client.Options
// Service, if set, is the service `update` restarts when no launcher runs.
Service *service.Spec
// Launcher tunes `run`. Binary, StateDir and Version come from Client.
Launcher restart.LauncherOptions
}
Config is what the host supplies. It is a function so the host loads its configuration only when a command actually runs.