Documentation
¶
Index ¶
- Constants
- func CheckUpdates(b models.Binaries, a ...string) (models.Binaries, error)
- func DownloadAndMoveFiles(b models.Binaries) error
- func NeedsRoot(b models.Binaries) bool
- func NeedsRootForRemoval(b models.Binaries) bool
- func PackageManagerName(b models.Binaries) string
- func PackageToRemove(b models.Binaries) (string, error)
- func PrepareElevation() error
- func RemoveInstalledFiles(b models.Binaries) error
- func ResolvedInstallType(b models.Binaries) models.PackageType
Constants ¶
const ( GitHub = iota + 1 Others )
Variables ¶
This section is empty.
Functions ¶
func CheckUpdates ¶
CheckUpdates Does four things:
1. Get the current version of the binary 2. Find the provider of the binary 3. Check for the new version of the binary 4. Compare the current version with the new version
func DownloadAndMoveFiles ¶
DownloadAndMoveFiles downloads a release asset and installs it.
For an archive it does five things:
1. Download the file 2. Verify the file 3. Uncompress the file 4. Move the files to the install location 5. Verify the new binary
For a deb or rpm the download and checksum verification are the same, but steps 3 to 5 are replaced by handing the file to the host's package manager and then confirming the installed version.
func NeedsRootForRemoval ¶
NeedsRootForRemoval reports whether uninstalling b requires root. Unlike NeedsRoot it reads the config directly, because an inactive binary never goes through the update check that resolves the install spec.
func PackageManagerName ¶
PackageManagerName returns the tool that would install b, for display in the dry-run summary. It returns an empty string when b is not a package install or when no suitable manager exists on this host.
func PackageToRemove ¶
PackageToRemove reports which package an inactive config would uninstall, for the --check and --dry-run summaries. An empty name with no error means nothing is installed.
func PrepareElevation ¶
func PrepareElevation() error
PrepareElevation resolves how to become root, prompting for a password if that is the only available route. Call it once, from a point where a prompt is acceptable, before any concurrent installs start.
func RemoveInstalledFiles ¶
RemoveInstalledFiles deletes what a binary installed when its config is inactive and settings.deleteIfNotActive is set.
Removing the whole install location is unsafe when it is the shared "~/bin" directory, since other binaries' configs may install there too. In that case only the files this binary installed are removed; otherwise the entire install location directory is removed. A deb or rpm install is owned by the package manager, which knows every path it wrote; deleting InstallLocation would miss those files entirely, so such a config is uninstalled through the package manager instead.
func ResolvedInstallType ¶
func ResolvedInstallType(b models.Binaries) models.PackageType
ResolvedInstallType returns the install type a config resolves to on this host, reading the download entry directly so it also works for a binary that has not been through the update check.
Types ¶
This section is empty.