Documentation ¶
Index ¶
- Constants
- Variables
- func AlwaysFailedInstallHandler(raucPath string) error
- func AlwaysSuccessInstallHandler(raucPath string) error
- func BestByDelay(urls []string) string
- func CheckMemory() error
- func CheckOfflineRAUCExist(sysRoot string) bool
- func CleanupOfflineRAUCTemp(sysRoot string) error
- func CurrentModuleVersion(module string, sysrootPath string) (*semver.Version, error)
- func CurrentReleaseVersion(sysRootPath string) (*semver.Version, error)
- func DownloadChecksum(ctx context.Context, release codegen.Release, mirror string) (string, error)
- func DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
- func DownloadUninstallScript(ctx context.Context, sysRoot string) (string, error)
- func ExtractRAUCRelease(packageFilepath string, release codegen.Release) error
- func FetchRelease(ctx context.Context, tag string, ...) (*codegen.Release, error)
- func GetChecksums(release codegen.Release) (map[string]string, error)
- func GetDescription(raucInfo string) (string, error)
- func GetRAUCInfo(path string) (string, error)
- func GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
- func GetReleaseBranch(sysRoot string) string
- func GitHubBranchTagReleaseURL(tag string, _ string) string
- func HyperFileTagReleaseURL(tag string, mirror string) string
- func InstallRAUC(release codegen.Release, sysRoot string, ...) error
- func InstallRAUCImp(raucFilePath string) error
- func InstallRelease(release codegen.Release, sysRootPath string) error
- func IsCasaOS(sysRoot string) bool
- func IsNewerVersion(current *semver.Version, target *semver.Version) bool
- func IsNewerVersionString(current string, target string) bool
- func IsZimaOS(sysRoot string) bool
- func MarkGood() error
- func MigrationToolsDir() string
- func MockInstallRAUC(raucFilePath string) error
- func MockRAUCInfo(content string) (string, error)
- func NormalizationVersion(version string) string
- func NormalizeVersion(version string) string
- func OfflineRAUCFilePath() string
- func PostInstallRAUC(release codegen.Release, sysRoot string) error
- func PublishEventWrapper(ctx context.Context, eventType message_bus.EventType, ...)
- func RAUCFilePath(release codegen.Release) (string, error)
- func RebootSystem()
- func ShouldUpgrade(release codegen.Release, sysRootPath string) bool
- func VerifyChecksumByFilePath(filepath, checksum string) error
- func VerifyUninstallScript(sysRoot string) bool
- type BestURLFunc
- type ConstructReleaseFileURLFunc
- type EventType
- type InstallerServiceInterface
- type InstallerType
- type RAUCOfflineService
- func (r *RAUCOfflineService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
- func (r *RAUCOfflineService) ExtractRelease(packageFilepath string, release codegen.Release) error
- func (r *RAUCOfflineService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
- func (r *RAUCOfflineService) Install(release codegen.Release, sysRoot string) error
- func (r *RAUCOfflineService) InstallInfo(release codegen.Release, sysRootPath string) (string, error)
- func (r *RAUCOfflineService) IsUpgradable(release codegen.Release, sysRootPath string) bool
- func (r *RAUCOfflineService) Launch(sysRoot string) error
- func (r *RAUCOfflineService) LoadReleaseFromRAUC(sysRoot string) (*codegen.Release, error)
- func (r *RAUCOfflineService) PostInstall(release codegen.Release, sysRoot string) error
- func (r *RAUCOfflineService) PostMigration(sysRoot string) error
- func (r *RAUCOfflineService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
- func (r *RAUCOfflineService) VerifyRelease(release codegen.Release) (string, error)
- type RAUCService
- func (r *RAUCService) CleanRelease(ctx context.Context, release codegen.Release) error
- func (r *RAUCService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
- func (r *RAUCService) ExtractRelease(packageFilepath string, release codegen.Release) error
- func (r *RAUCService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
- func (r *RAUCService) Install(release codegen.Release, sysRoot string) error
- func (r *RAUCService) InstallInfo(release codegen.Release, sysRootPath string) (string, error)
- func (r *RAUCService) IsUpgradable(release codegen.Release, sysRootPath string) bool
- func (r *RAUCService) Launch(sysRoot string) error
- func (r *RAUCService) PostInstall(release codegen.Release, sysRoot string) error
- func (r *RAUCService) PostMigration(sysRoot string) error
- func (r *RAUCService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
- func (r *RAUCService) VerifyRelease(release codegen.Release) (string, error)
- type Services
- type StatusService
- func (r *StatusService) Cronjob(ctx context.Context, sysRoot string) error
- func (r *StatusService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
- func (r *StatusService) ExtractRelease(packageFilepath string, release codegen.Release) error
- func (r *StatusService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
- func (r *StatusService) GetStatus() (codegen.Status, string)
- func (r *StatusService) InitEventTypeMapStatus()
- func (r *StatusService) Install(release codegen.Release, sysRoot string) error
- func (r *StatusService) InstallInfo(release codegen.Release, sysRootPath string) (string, error)
- func (r *StatusService) IsUpgradable(release codegen.Release, sysRootPath string) bool
- func (r *StatusService) Launch(sysRoot string) error
- func (r *StatusService) PostInstall(release codegen.Release, sysRoot string) error
- func (r *StatusService) PostMigration(sysRoot string) error
- func (r *StatusService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
- func (r *StatusService) UpdateStatusWithMessage(eventType EventType, eventMessage string)
- func (r *StatusService) VerifyRelease(release codegen.Release) (string, error)
- type TarService
- type TestService
- func (r *TestService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
- func (r *TestService) ExtractRelease(packageFilepath string, release codegen.Release) error
- func (r *TestService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
- func (r *TestService) Install(release codegen.Release, sysRoot string) error
- func (r *TestService) InstallInfo(release codegen.Release, sysRootPath string) (string, error)
- func (r *TestService) IsUpgradable(release codegen.Release, sysRootPath string) bool
- func (r *TestService) Launch(sysRoot string) error
- func (r *TestService) PostInstall(release codegen.Release, sysRoot string) error
- func (r *TestService) PostMigration(sysRoot string) error
- func (r *TestService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
- func (r *TestService) VerifyRelease(release codegen.Release) (string, error)
- type UpdaterServiceInterface
Constants ¶
View Source
const ( DownloadCostTime = 2 * time.Second GetReleaseCostTime = 2 * time.Second )
View Source
const (
FlagUpgradeFile = "/var/lib/casaos/upgradeInfo.txt"
)
Variables ¶
View Source
var ( MyService Services InstallerService *StatusService )
View Source
var CurrentReleaseLocalPath = "/etc/release.yaml"
View Source
var ErrHaveOtherCron = fmt.Errorf("have other cron")
View Source
var (
ErrReleaseNotFound = fmt.Errorf("release not found")
)
View Source
var MockContent string = ``
View Source
var ShouldUpgradeCount int = 0
View Source
var Test_server_count_lock sync.RWMutex = sync.RWMutex{}
Functions ¶
func BestByDelay ¶
func CheckMemory ¶
func CheckMemory() error
func CheckOfflineRAUCExist ¶
func CleanupOfflineRAUCTemp ¶
func CurrentModuleVersion ¶
func CurrentReleaseVersion ¶
func DownloadChecksum ¶
func DownloadRelease ¶
returns releaseFilePath if successful
func DownloadUninstallScript ¶
func ExtractRAUCRelease ¶ added in v0.2.0
func FetchRelease ¶
func GetDescription ¶
func GetRAUCInfo ¶
func GetReleaseBranch ¶ added in v0.2.0
func HyperFileTagReleaseURL ¶
func InstallRAUC ¶
func InstallRAUC(release codegen.Release, sysRoot string, InstallRAUCHandler func(raucPath string) error) error
dependent config.ServerInfo.CachePath
func InstallRAUCImp ¶
func IsNewerVersion ¶
func IsNewerVersion(current *semver.Version, target *semver.Version) bool
func IsNewerVersionString ¶
func MigrationToolsDir ¶
func MigrationToolsDir() string
func MockInstallRAUC ¶
func MockRAUCInfo ¶
func NormalizationVersion ¶ added in v0.2.0
func NormalizeVersion ¶
func OfflineRAUCFilePath ¶
func OfflineRAUCFilePath() string
func PostInstallRAUC ¶ added in v0.2.0
func PublishEventWrapper ¶
func RebootSystem ¶
func RebootSystem()
func VerifyChecksumByFilePath ¶
sha256sum
func VerifyUninstallScript ¶
Types ¶
type BestURLFunc ¶
type EventType ¶ added in v0.2.0
type EventType string
const ( DownloadBegin EventType = "downloadBegin" DownloadEnd EventType = "downloadEnd" DownloadError EventType = "downloadError" FetchUpdateEnd EventType = "fetchUpdateEnd" FetchUpdateBegin EventType = "fetchUpdateBegin" FetchUpdateError EventType = "fetchUpdateError" Idle EventType = "idle" InstallEnd EventType = "installEnd" InstallBegin EventType = "installBegin" InstallError EventType = "installError" )
type InstallerServiceInterface ¶ added in v0.2.0
type InstallerServiceInterface interface { }
type InstallerType ¶ added in v0.2.0
type InstallerType string
const ( RAUC InstallerType = "rauc" RAUCOFFLINE InstallerType = "rauc_offline" TAR InstallerType = "tar" )
func GetInstallMethod ¶
func GetInstallMethod(sysRoot string) (InstallerType, error)
type RAUCOfflineService ¶ added in v0.2.0
type RAUCOfflineService struct { SysRoot string InstallRAUCHandler func(raucPath string) error CheckSumHandler out.CheckSumReleaseUseCase GetRAUCInfo func(string) (string, error) }
func (*RAUCOfflineService) DownloadRelease ¶ added in v0.2.0
func (*RAUCOfflineService) ExtractRelease ¶ added in v0.2.0
func (r *RAUCOfflineService) ExtractRelease(packageFilepath string, release codegen.Release) error
func (*RAUCOfflineService) GetRelease ¶ added in v0.2.0
func (*RAUCOfflineService) Install ¶ added in v0.2.0
func (r *RAUCOfflineService) Install(release codegen.Release, sysRoot string) error
func (*RAUCOfflineService) InstallInfo ¶
func (*RAUCOfflineService) IsUpgradable ¶ added in v0.2.0
func (r *RAUCOfflineService) IsUpgradable(release codegen.Release, sysRootPath string) bool
func (*RAUCOfflineService) Launch ¶
func (r *RAUCOfflineService) Launch(sysRoot string) error
func (*RAUCOfflineService) LoadReleaseFromRAUC ¶
func (r *RAUCOfflineService) LoadReleaseFromRAUC(sysRoot string) (*codegen.Release, error)
func (*RAUCOfflineService) PostInstall ¶ added in v0.2.0
func (r *RAUCOfflineService) PostInstall(release codegen.Release, sysRoot string) error
func (*RAUCOfflineService) PostMigration ¶ added in v0.2.0
func (r *RAUCOfflineService) PostMigration(sysRoot string) error
func (*RAUCOfflineService) ShouldUpgrade ¶ added in v0.2.0
func (r *RAUCOfflineService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
func (*RAUCOfflineService) VerifyRelease ¶ added in v0.2.0
func (r *RAUCOfflineService) VerifyRelease(release codegen.Release) (string, error)
type RAUCService ¶ added in v0.2.0
type RAUCService struct { InstallRAUCHandler func(raucPath string) error DownloadHandler out.DownloadReleaseUseCase CheckSumHandler out.CheckSumReleaseUseCase URLHandler ConstructReleaseFileURLFunc // contains filtered or unexported fields }
func (*RAUCService) CleanRelease ¶
func (*RAUCService) DownloadRelease ¶ added in v0.2.0
func (*RAUCService) ExtractRelease ¶ added in v0.2.0
func (r *RAUCService) ExtractRelease(packageFilepath string, release codegen.Release) error
func (*RAUCService) GetRelease ¶ added in v0.2.0
func (*RAUCService) Install ¶ added in v0.2.0
func (r *RAUCService) Install(release codegen.Release, sysRoot string) error
func (*RAUCService) InstallInfo ¶
func (*RAUCService) IsUpgradable ¶ added in v0.2.0
func (r *RAUCService) IsUpgradable(release codegen.Release, sysRootPath string) bool
func (*RAUCService) Launch ¶
func (r *RAUCService) Launch(sysRoot string) error
func (*RAUCService) PostInstall ¶ added in v0.2.0
func (r *RAUCService) PostInstall(release codegen.Release, sysRoot string) error
func (*RAUCService) PostMigration ¶ added in v0.2.0
func (r *RAUCService) PostMigration(sysRoot string) error
func (*RAUCService) ShouldUpgrade ¶ added in v0.2.0
func (r *RAUCService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
func (*RAUCService) VerifyRelease ¶ added in v0.2.0
func (r *RAUCService) VerifyRelease(release codegen.Release) (string, error)
type Services ¶
type Services interface { Gateway() (external.ManagementService, error) MessageBus() (*message_bus.ClientWithResponses, error) }
func NewService ¶
type StatusService ¶ added in v0.2.0
type StatusService struct { ImplementService UpdaterServiceInterface EventTypeMapStatus map[EventType]codegen.Status EventTypeMapMessageType map[EventType]message_bus.EventType SysRoot string // contains filtered or unexported fields }
func NewStatusService ¶
func NewStatusService(implementService UpdaterServiceInterface, sysRoot string) *StatusService
func (*StatusService) Cronjob ¶ added in v0.2.0
func (r *StatusService) Cronjob(ctx context.Context, sysRoot string) error
func (*StatusService) DownloadRelease ¶ added in v0.2.0
func (*StatusService) ExtractRelease ¶ added in v0.2.0
func (r *StatusService) ExtractRelease(packageFilepath string, release codegen.Release) error
func (*StatusService) GetRelease ¶ added in v0.2.0
func (*StatusService) InitEventTypeMapStatus ¶
func (r *StatusService) InitEventTypeMapStatus()
func (*StatusService) Install ¶ added in v0.2.0
func (r *StatusService) Install(release codegen.Release, sysRoot string) error
func (*StatusService) InstallInfo ¶
func (*StatusService) IsUpgradable ¶ added in v0.2.0
func (r *StatusService) IsUpgradable(release codegen.Release, sysRootPath string) bool
func (*StatusService) Launch ¶
func (r *StatusService) Launch(sysRoot string) error
func (*StatusService) PostInstall ¶ added in v0.2.0
func (r *StatusService) PostInstall(release codegen.Release, sysRoot string) error
func (*StatusService) PostMigration ¶ added in v0.2.0
func (r *StatusService) PostMigration(sysRoot string) error
func (*StatusService) ShouldUpgrade ¶ added in v0.2.0
func (r *StatusService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
func (*StatusService) UpdateStatusWithMessage ¶
func (r *StatusService) UpdateStatusWithMessage(eventType EventType, eventMessage string)
func (*StatusService) VerifyRelease ¶ added in v0.2.0
func (r *StatusService) VerifyRelease(release codegen.Release) (string, error)
type TarService ¶ added in v0.2.0
type TarService struct{}
func (*TarService) GetRelease ¶ added in v0.2.0
type TestService ¶ added in v0.2.0
type TestService struct { InstallRAUCHandler func(raucPath string) error DownloadStatusLock sync.RWMutex // contains filtered or unexported fields }
func (*TestService) DownloadRelease ¶ added in v0.2.0
func (*TestService) ExtractRelease ¶ added in v0.2.0
func (r *TestService) ExtractRelease(packageFilepath string, release codegen.Release) error
func (*TestService) GetRelease ¶ added in v0.2.0
func (*TestService) Install ¶ added in v0.2.0
func (r *TestService) Install(release codegen.Release, sysRoot string) error
func (*TestService) InstallInfo ¶
func (*TestService) IsUpgradable ¶ added in v0.2.0
func (r *TestService) IsUpgradable(release codegen.Release, sysRootPath string) bool
func (*TestService) Launch ¶
func (r *TestService) Launch(sysRoot string) error
func (*TestService) PostInstall ¶ added in v0.2.0
func (r *TestService) PostInstall(release codegen.Release, sysRoot string) error
func (*TestService) PostMigration ¶ added in v0.2.0
func (r *TestService) PostMigration(sysRoot string) error
func (*TestService) ShouldUpgrade ¶ added in v0.2.0
func (r *TestService) ShouldUpgrade(release codegen.Release, sysRoot string) bool
func (*TestService) VerifyRelease ¶ added in v0.2.0
func (r *TestService) VerifyRelease(release codegen.Release) (string, error)
type UpdaterServiceInterface ¶ added in v0.2.0
type UpdaterServiceInterface interface { GetRelease(ctx context.Context, tag string) (*codegen.Release, error) VerifyRelease(release codegen.Release) (string, error) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error) ExtractRelease(packageFilepath string, release codegen.Release) error Install(release codegen.Release, sysRoot string) error PostInstall(release codegen.Release, sysRoot string) error Launch(sysRoot string) error PostMigration(sysRoot string) error ShouldUpgrade(release codegen.Release, sysRoot string) bool IsUpgradable(release codegen.Release, sysRootPath string) bool // 检测预下载的包好了没有 InstallInfo(release codegen.Release, sysRoot string) (string, error) }
func NewInstallerService ¶ added in v0.2.0
func NewInstallerService(sysRoot string) UpdaterServiceInterface
Source Files ¶
Click to show internal directories.
Click to hide internal directories.