update

package
v0.0.0-...-028f1de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUnixInstallDir   = "/usr/local/share/aliyun-assist"
	DefaultUnixAgentName    = "aliyun-service"
	DefaultUnixUpdateScript = "update_install"
	DefaultUnixUpdatorName  = "aliyun_assist_update"

	DefaultWindowsInstallDir   = "C:\\ProgramData\\aliyun\\assist"
	DefaultWindowsAgentName    = "aliyun_assist_service.exe"
	DefaultWindowsUpdateScript = "install.bat"
	DefaultWindowsUpdatorName  = "aliyun_assist_update.exe"
)

Variables

View Source
var (
	ErrInvalidELF                 = errors.New("Invalid ELF-format executable")
	ErrELFUnsupportedOSABI        = errors.New("Unsupported OSABI identifier of ELF executable")
	ErrELFUnsupportedArchitecture = errors.New("Unsupported architecture identifier of ELF executable")

	ErrInvalidPE                 = errors.New("Invalid PE-format executable")
	ErrPEUnsupportedArchitecture = errors.New("Unsupported architecture identifier of PE executable")
)

Functions

func CompareFileMD5

func CompareFileMD5(filePath string, expectedMD5 string) error

func DownloadPackage

func DownloadPackage(url string, savePath string, timeout time.Duration) error

func ExecuteUpdateScript

func ExecuteUpdateScript(updateScriptPath string) error

func ExtractPackage

func ExtractPackage(filePath string, destination string) error

func ExtractVersionStringFromURL

func ExtractVersionStringFromURL(url string) (string, error)

func GetAgentName

func GetAgentName() string

func GetAgentPathByVersion

func GetAgentPathByVersion(version string) string

func GetInstallDir

func GetInstallDir() string

func GetInstallDirByCurrentProcess

func GetInstallDirByCurrentProcess() (string, error)

GetInstallDirByCurrentProcess returns normal install direcotry of agent. When agent is installed as **/a/b/aliyun-service, it would return **/a . The "normal install directory" on most Linux distribution: /usr/local/share/aliyun-assist on CoreOS specially: /opt/local/share/aliyun-assist on Windows: C:\ProgramData\aliyun\assist

func GetUpdateScript

func GetUpdateScript() string

func GetUpdateScriptPathByVersion

func GetUpdateScriptPathByVersion(version string) string

func GetUpdatorName

func GetUpdatorName() string

func GetUpdatorPathByCurrentProcess

func GetUpdatorPathByCurrentProcess() string

func RemoveOldVersion

func RemoveOldVersion(multipleVersionDir string) error

func RemoveUpdatePackage

func RemoveUpdatePackage(tempSavePath string) error

func ReportCheckMD5Failed

func ReportCheckMD5Failed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportDownloadPackageFailed

func ReportDownloadPackageFailed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportExecuteUpdateScriptFailed

func ReportExecuteUpdateScriptFailed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportExecuteUpdateScriptRunnerFailed

func ReportExecuteUpdateScriptRunnerFailed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportExecuteUpdateScriptRunnerTimeout

func ReportExecuteUpdateScriptRunnerTimeout(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportExtractPackageFailed

func ReportExtractPackageFailed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ReportValidateExecutableFailed

func ReportValidateExecutableFailed(err error, updateInfo *UpdateCheckResp, failureContext map[string]interface{})

func ValidateExecutable

func ValidateExecutable(executablePath string) error

Types

type UpdateCheckReport

type UpdateCheckReport struct {
	Os            string `json:"os"`
	Arch          string `json:"arch"`
	OsVersion     string `json:"os_version"`
	AppID         string `json:"app_id"`
	AppVersion    string `json:"app_version"`
	KernelVersion string `json:"kernel_version"`
}

type UpdateCheckResp

type UpdateCheckResp struct {
	Flag         int64  `json:"flag"`
	InstanceID   string `json:"instanceId"`
	NeedUpdate   int64  `json:"need_update"`
	NextInterval int64  `json:"next_interval"`
	UpdateInfo   struct {
		FileName string `json:"file_name"`
		Md5      string `json:"md5"`
		URL      string `json:"url"`
	} `json:"update_info"`
}

func FetchUpdateInfo

func FetchUpdateInfo() (*UpdateCheckResp, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL