Documentation
¶
Overview ¶
Package update finds newer conch builds — a rebuilt or downloaded binary, a GitHub release, machines running older builds — and applies them without stopping panes: binaries are replaced, servers reloaded.
Index ¶
- Variables
- func AppReplaceable(app string) error
- func AppVersion(app string) (string, bool)
- func Compare(a, b string) int
- func Executable() (string, error)
- func InstallApp(ctx context.Context, version, app string, say func(string)) error
- func InstallRelease(ctx context.Context, version, exe string) error
- func Kept(version string) (string, bool)
- func Machine(ctx context.Context, c *client.Client, tr remote.Transport, say func(string)) error
- func Managed(exe string) error
- func Previous() string
- func PreviousApp(app string) (string, bool)
- func Releases(ctx context.Context) ([]string, error)
- func Reload(ctx context.Context, c *client.Client, bin string) error
- func RollbackApp(app string) error
- func SameBuild(s proto.HelloResult) (same, ok bool)
- func VerifyApp(ctx context.Context, next, running string) error
- type AppCheck
- type Release
Constants ¶
This section is empty.
Variables ¶
var ErrHomebrew = errors.New("conch was installed with Homebrew: update it with brew upgrade conch")
ErrHomebrew is an update refused because Homebrew installed conch.
Functions ¶
func AppReplaceable ¶ added in v0.2.1
AppReplaceable says why the Conch.app at app cannot be replaced by an update, or nil when it can: run translocated (macOS's random read-only copy of an app opened where it was downloaded), from its disk image, or from somewhere this user cannot write — an install made by an admin. The update renames the bundle within its folder, so both have to be writable.
func AppVersion ¶ added in v0.2.1
AppVersion reads an app's CFBundleShortVersionString; ok is false when there is no bundle there.
func Compare ¶
Compare orders versions like "0.2.0" and "0.10.1-rc.1": -1, 0 or 1, as SemVer does. Pre-release suffixes sort before the release; build metadata ("+build.5") is ignored.
func Executable ¶
Executable is the running conch's path, symlinks resolved — except a Homebrew install's, which is its opt link (buildinfo.Stable): the file to watch for a new build, and to restart onto, is wherever brew puts the next version.
func InstallApp ¶ added in v0.2.1
InstallApp replaces the Conch.app at app with release version: it downloads the release's archive and checks its checksum, unpacks it beside the app (the same volume, so the swap is a rename), checks the version inside and its signature, and then swaps the two, keeping the one it replaces for RollbackApp. Anything refused leaves the app as it was and nothing beside it. The running app carries on from the files it has open; the new one runs from its next launch.
func InstallRelease ¶
InstallRelease puts the conch of version over the executable at exe: the published release for this platform, or the copy kept when conch moved off that version. The outgoing binary is kept and noted, so moving back to it later needs no download. version may be older than the running one — going backwards is the same swap.
func Kept ¶ added in v0.1.3
Kept is the binary conch kept of version when it moved off it, so going back needs no download.
func Machine ¶
Machine installs this build on a remote machine and reloads its server onto it, keeping its panes.
func Previous ¶ added in v0.1.3
func Previous() string
Previous is the version conch ran before the last update or move back, "" when none was recorded (a fresh install, or the note was removed). Moving back notes the version left behind in turn, so back and forward are the same step.
func PreviousApp ¶ added in v0.2.1
PreviousApp is the version of the app kept from the last update, if any.
func Releases ¶ added in v0.1.3
Releases lists the versions published upstream — what the install script would fetch — newest first.
func RollbackApp ¶ added in v0.2.1
RollbackApp swaps the app with the one kept from the last update, so the release just undone is kept in turn and can be gone forward to.
func SameBuild ¶
func SameBuild(s proto.HelloResult) (same, ok bool)
SameBuild reports whether a server runs the same conch as this process. Release builds compare versions (a downloaded binary for another platform has its own hash); development builds compare build IDs, which cross-built binaries inherit. ok is false when the server can't tell.
func VerifyApp ¶ added in v0.2.1
VerifyApp checks a downloaded Conch.app before it replaces the running one: its signature intact (deep and strict), made by the same team as the app running now, and accepted by Gatekeeper as notarized. A running app signed ad hoc — built by hand — has no team to match, so it is refused too: nothing would say the download came from the same hands.
Types ¶
type AppCheck ¶ added in v0.2.1
type AppCheck struct {
// Current is the app's own version, as it was given.
Current string `json:"current"`
// Dev is a build from source, which never asks: it updates from source.
Dev bool `json:"dev,omitempty"`
// Latest is the newest published release, when one was asked for.
Latest string `json:"latest,omitempty"`
// Newer is Latest being newer than Current.
Newer bool `json:"newer,omitempty"`
// Notes is the page the release is described on.
Notes string `json:"notes,omitempty"`
// Asset is the archive this Mac would download, or "" with Unavailable
// saying why there is none (an Intel Mac).
Asset string `json:"asset,omitempty"`
}
AppCheck is what Conch.app's check for a newer release of itself found (`conch app update check -json`, which the app reads).