service

package
v0.1.2-alpha9 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RAUCOfflinePath        = "/Data/rauc/"
	RAUCOfflineReleaseFile = "rauc-release.yml"
	RAUCOfflineRAUCFile    = "rauc.tar.gz"
)

Variables

View Source
var (
	CurrentReleaseLocalPath = "/etc/casaos/release.yaml"
	TargetReleaseLocalPath  = "/etc/casaos/target-release.yaml"
)
View Source
var (
	ErrReleaseNotFound = fmt.Errorf("release not found")
)
View Source
var FallbackStaticFiles embed.FS

embeded static files

Functions

func CurrentModuleVersion

func CurrentModuleVersion(module string, sysrootPath string) (*semver.Version, error)

func CurrentReleaseVersion

func CurrentReleaseVersion(sysrootPath string) (*semver.Version, error)

func DownloadAllMigrationTools

func DownloadAllMigrationTools(ctx context.Context, release codegen.Release, sysrootPath string) (bool, error)

func DownloadChecksum

func DownloadChecksum(ctx context.Context, release codegen.Release, mirror string) (string, error)

func DownloadMigrationTool

func DownloadMigrationTool(ctx context.Context, release codegen.Release, moduleName string, migration MigrationTool, force bool) (string, error)

func DownloadRelease

func DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

returns releaseFilePath if successful

func DownloadUninstallScript

func DownloadUninstallScript(ctx context.Context, sysRoot string) (string, error)

func ExecuteMigrationTool

func ExecuteMigrationTool(moduleName string, migrationFilePath string, sysRoot string) error

func ExecuteModuleInstallScript

func ExecuteModuleInstallScript(releaseFilePath string, release codegen.Release) error

func ExtractReleasePackages

func ExtractReleasePackages(packageFilepath string, release codegen.Release) error

func GetChecksums

func GetChecksums(release codegen.Release) (map[string]string, error)

func GetFileNameFromMigrationURL

func GetFileNameFromMigrationURL(url string) string

func GetInstallMethod

func GetInstallMethod(sysRoot string) (string, error)

func GetMigrationDownloadURLFromMigrationListURL

func GetMigrationDownloadURLFromMigrationListURL(url string) string

func GetRelease

func GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func GetReleaseBranch added in v0.2.0

func GetReleaseBranch(sysRoot string) string

func GetStatus added in v0.2.0

func GetStatus() codegen.Status

func InstallCasaOSPackages

func InstallCasaOSPackages(release codegen.Release, sysRoot string) error

dependent config.ServerInfo.CachePath

func InstallDependencies

func InstallDependencies(release codegen.Release, sysrootPath string) error

func InstallRAUC

func InstallRAUC(release codegen.Release, sysRoot string) error

dependent config.ServerInfo.CachePath

func InstallRelease

func InstallRelease(release codegen.Release, sysrootPath string) error

func InstallSystem

func InstallSystem(release codegen.Release, sysRoot string) error

func IsCasaOS

func IsCasaOS(sysRoot string) bool

func IsUpgradable

func IsUpgradable(release codegen.Release, sysrootPath string) bool

to check the new version is upgradable and packages are already cached(download)

func IsZimaOS

func IsZimaOS(sysRoot string) bool

func LaunchModule

func LaunchModule(release codegen.Release) error

func LoadReleaseFromLocal

func LoadReleaseFromLocal() (*codegen.Release, error)

func MigrationToolsDir

func MigrationToolsDir() string

func MigrationToolsMap

func MigrationToolsMap(release codegen.Release) (map[string][]MigrationTool, error)

func NormalizationVersion added in v0.2.0

func NormalizationVersion(version string) string

func NormalizeMigrationToolURL

func NormalizeMigrationToolURL(url string) string

Normalize migraiton tool URL to a standard format which uses `${MIRROR}` as the mirror placeholder

func NormalizeMigrationToolURLPass1

func NormalizeMigrationToolURLPass1(url string) string

func NormalizeMigrationToolURLPass2

func NormalizeMigrationToolURLPass2(url string) string

func NormalizeVersion

func NormalizeVersion(version string) string

func PostMigration

func PostMigration(sysRoot string) error

func PostReleaseInstall

func PostReleaseInstall(release codegen.Release, sysrootPath string) error

func PublishEventWrapper

func PublishEventWrapper(ctx context.Context, eventType message_bus.EventType, properties map[string]string)

func RebootSystem

func RebootSystem()

func ReleaseDir

func ReleaseDir(release codegen.Release) (string, error)

func ShouldUpgrade

func ShouldUpgrade(release codegen.Release, sysrootPath string) bool

func StartFallbackWebsite added in v0.2.0

func StartFallbackWebsite()

func StartMigration

func StartMigration(sysRoot string) error

func StopFallbackWebsite added in v0.2.0

func StopFallbackWebsite()

func StopModule

func StopModule(release codegen.Release) error

func UpdateStatus

func UpdateStatus(newStatus codegen.Status)

func VerifyAllMigrationTools

func VerifyAllMigrationTools(targetRelease codegen.Release, sysRoot string) bool

verify migration tools for a release are already cached

func VerifyChecksumByFilePath

func VerifyChecksumByFilePath(filepath, checksum string) error

sha256sum

func VerifyMigrationTool

func VerifyMigrationTool(moduleName string, fileName string) (string, error)

func VerifyRAUC

func VerifyRAUC(release codegen.Release) (string, error)

func VerifyRelease

func VerifyRelease(release codegen.Release) (string, error)

func VerifyUninstallScript

func VerifyUninstallScript(sysRoot string) bool

Types

type InstallerServices

type InstallerServices 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)
	Install(release codegen.Release, sysRoot string) error
	MigrationInLaunch(sysRoot string) error
}
var InstallerService InstallerServices

func NewInstallerService added in v0.2.0

func NewInstallerService(sysRoot string) InstallerServices

type MigrationTool

type MigrationTool struct {
	Version semver.Version
	URL     string
}

func GetMigrationPath

func GetMigrationPath(module codegen.Module, release codegen.Release, migrationToolMap map[string][]MigrationTool, sysRoot string) ([]MigrationTool, error)

func RemoveDuplication

func RemoveDuplication(arr []MigrationTool) []MigrationTool

type RAUCService added in v0.2.0

type RAUCService struct {
}

func (*RAUCService) DownloadRelease added in v0.2.0

func (r *RAUCService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

func (*RAUCService) GetRelease added in v0.2.0

func (r *RAUCService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*RAUCService) Install added in v0.2.0

func (r *RAUCService) Install(release codegen.Release, sysRoot string) error

func (*RAUCService) MigrationInLaunch added in v0.2.0

func (r *RAUCService) MigrationInLaunch(sysRoot string) error

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)
}
var MyService Services

func NewService

func NewService(RuntimePath string) Services

type TarService added in v0.2.0

type TarService struct {
}

func (*TarService) GetRelease added in v0.2.0

func (r *TarService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*TarService) Install added in v0.2.0

func (r *TarService) Install(release codegen.Release, sysRoot string) error

Jump to

Keyboard shortcuts

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