Documentation
¶
Overview ¶
Package update finds monolith's latest GitHub release and installs a release over the running binary, with the checks install.sh makes: the archive's sha256 against the release's checksums.txt, then the binary's code signature and virtualization entitlement.
Index ¶
- Constants
- func Canonical(v string) string
- func CheckLatest() (string, error)
- func Compare(a, b string) int
- func Download(ctx context.Context, client *http.Client, version, dir string, log io.Writer) (string, error)
- func IsRelease(v string) bool
- func Latest(ctx context.Context, client *http.Client) (string, error)
- func Replace(src, dst string) (sudo bool, err error)
- func Target() (string, error)
- func VerifySignature(path string) error
Constants ¶
const (
// EnvNoCheck turns off the release check in 'monolith --version'.
EnvNoCheck = "MONOLITH_NO_UPDATE_CHECK"
)
Environment overrides, for mirrors and tests. MONOLITH_BASE_URL is the same variable install.sh reads.
Variables ¶
This section is empty.
Functions ¶
func CheckLatest ¶
CheckLatest is Latest with a short timeout, for 'monolith --version'.
func Download ¶
func Download(ctx context.Context, client *http.Client, version, dir string, log io.Writer) (string, error)
Download fetches version's release archive and checksums into dir, checks the archive's sha256 and returns the path of the binary it extracted. log gets a line per stage.
func IsRelease ¶
IsRelease reports whether v is a release build's version: a semver tag, not "dev" or a git describe of a commit past one.
func Replace ¶
Replace puts the binary at src in dst's place. If dst's directory is writable it's a rename of a copy made next to dst, so dst is never half written; otherwise it runs sudo install, which asks for a password on the terminal. It reports whether sudo was used.
func VerifySignature ¶
VerifySignature checks that the binary at path has a valid code signature and the virtualization entitlement, which monolith needs.
Types ¶
This section is empty.