config

package
v0.0.0-...-434a8ce Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OemRepoDirPath                      = "/etc/deepin/lastore-daemon/oem-repo.conf.d/"
	UseOemSystemRepoFlagFile            = ".use_oem_system_source_flag"
	UseOemSecurityRepoFlagFile          = ".use_oem_security_source_flag"
	BackupOemSystemSourceListFilePath   = "/etc/apt/sources.list.bak_oem"
	BackupOemSecuritySourceListFilePath = " /etc/apt/sources.list.d/security.list.bak_oem"
)
View Source
const ConfigVersion = "0.1"
View Source
const (
	DSettingsKeyLastoreDaemonStatus = "lastore-daemon-status"
)
View Source
const MinCheckInterval = time.Minute

Variables

This section is empty.

Functions

func GetOemRepoInfo

func GetOemRepoInfo(dir string) (*OemRepoConfig, *OemRepoConfig)

GetOemRepoInfo 获取系统和安全仓库OEM配置

Types

type Config

type Config struct {
	Version               string
	AutoCheckUpdates      bool
	DisableUpdateMetadata bool
	AutoDownloadUpdates   bool
	AutoClean             bool
	MirrorSource          string
	UpdateNotify          bool
	CheckInterval         time.Duration
	CleanInterval         time.Duration
	UpdateMode            system.UpdateType
	CheckUpdateMode       system.UpdateType

	// 缓存大小超出限制时的清理时间间隔
	CleanIntervalCacheOverLimit    time.Duration
	AppstoreRegion                 string
	LastCheckTime                  time.Time
	LastCleanTime                  time.Time
	LastCheckCacheSizeTime         time.Time
	Repository                     string
	MirrorsUrl                     string
	AllowInstallRemovePkgExecPaths []string
	AutoInstallUpdates             bool
	AutoInstallUpdateType          system.UpdateType

	AllowPostSystemUpgradeMessageVersion []string // 只有数组内的系统版本被允许发送更新完成的数据

	UpgradeStatus      system.UpgradeStatusAndReason
	IdleDownloadConfig string
	SystemSourceList   []string // 系统更新list文件路径
	SecuritySourceList []string // 安全更新list文件路径
	NonUnknownList     []string // 非未知来源更新list文件
	OtherSourceList    []string // 其他类型更新list文件路径

	DownloadSpeedLimitConfig string

	UpdateStatus   string
	PlatformUpdate bool

	PlatformUrl        string // 更新接口地址
	CheckPolicyCron    string // 策略检查间隔
	StartCheckRange    []int  // 开机检查更新区间
	IncludeDiskInfo    bool   // machineID是否包含硬盘信息
	PostUpgradeCron    string // 更新上报间隔
	UpdateTime         string // 定时更新
	PlatformDisabled   DisabledStatus
	EnableVersionCheck bool

	ClassifiedUpdatablePackages map[string][]string
	OnlineCache                 string

	EnableCoreList    bool
	ClientPackageName string

	SystemCustomSource      []string      // 系统更新自定义仓库内容
	SecurityCustomSource    []string      // 安全更新自定义仓库内容
	SystemOemSourceConfig   OemRepoConfig // 系统更新OEM仓库配置 来源/etc/deepin/lastore-daemon/oem-repo.conf.d
	SecurityOemSourceConfig OemRepoConfig // 安全更新OEM仓库配置 来源/etc/deepin/lastore-daemon/oem-repo.conf.d
	SystemRepoType          RepoType      // 系统更新仓库类型
	SecurityRepoType        RepoType      // 安全更新仓库类型
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(configPath string) *Config

func (*Config) ConnectConfigChanged

func (c *Config) ConnectConfigChanged(key string, cb func(LastoreDaemonStatus, interface{}))

func (*Config) GetLastoreDaemonStatus

func (c *Config) GetLastoreDaemonStatus() LastoreDaemonStatus

func (*Config) GetLastoreDaemonStatusByBit

func (c *Config) GetLastoreDaemonStatusByBit(key LastoreDaemonStatus) LastoreDaemonStatus

func (*Config) GetPlatformStatusDisable

func (c *Config) GetPlatformStatusDisable(status DisabledStatus) bool

func (*Config) ReloadSourcesDir

func (c *Config) ReloadSourcesDir()

ReloadSourcesDir 更新系统、安全仓库list文件,/var/lib/lastore/SystemSource.d和/var/lib/lastore/SecuritySource.d

func (*Config) SetAllowInstallRemovePkgExecPaths

func (c *Config) SetAllowInstallRemovePkgExecPaths(paths []string) error

func (*Config) SetAllowPostSystemUpgradeMessageVersion

func (c *Config) SetAllowPostSystemUpgradeMessageVersion(version []string) error

func (*Config) SetAppstoreRegion

func (c *Config) SetAppstoreRegion(region string) error

func (*Config) SetAutoCheckUpdates

func (c *Config) SetAutoCheckUpdates(enable bool) error

func (*Config) SetAutoClean

func (c *Config) SetAutoClean(enable bool) error

func (*Config) SetAutoDownloadUpdates

func (c *Config) SetAutoDownloadUpdates(enable bool) error

func (*Config) SetAutoInstallUpdateType

func (c *Config) SetAutoInstallUpdateType(updateType system.UpdateType) error

func (*Config) SetAutoInstallUpdates

func (c *Config) SetAutoInstallUpdates(autoInstall bool) error

func (*Config) SetCheckInterval

func (c *Config) SetCheckInterval(interval time.Duration) error

func (*Config) SetCheckUpdateMode

func (c *Config) SetCheckUpdateMode(mode system.UpdateType) error

func (*Config) SetClassifiedUpdatablePackages

func (c *Config) SetClassifiedUpdatablePackages(pkgMap map[string][]string) error

func (*Config) SetCleanInterval

func (c *Config) SetCleanInterval(interval time.Duration) error

func (*Config) SetCleanIntervalCacheOverLimit

func (c *Config) SetCleanIntervalCacheOverLimit(duration time.Duration) error

func (*Config) SetDisableUpdateMetadata

func (c *Config) SetDisableUpdateMetadata(disable bool) error

func (*Config) SetDownloadSpeedLimitConfig

func (c *Config) SetDownloadSpeedLimitConfig(config string) error

func (*Config) SetIdleDownloadConfig

func (c *Config) SetIdleDownloadConfig(idleConfig string) error

func (*Config) SetInstallUpdateTime

func (c *Config) SetInstallUpdateTime(delayed string) error

func (*Config) SetLastoreDaemonStatus

func (c *Config) SetLastoreDaemonStatus(status LastoreDaemonStatus) error

func (*Config) SetMirrorSource

func (c *Config) SetMirrorSource(id string) error

func (*Config) SetMirrorsUrl

func (c *Config) SetMirrorsUrl(mirrorsUrl string) error

func (*Config) SetOnlineCache

func (c *Config) SetOnlineCache(cache string) error

func (*Config) SetRepository

func (c *Config) SetRepository(repository string) error

func (*Config) SetSecurityCustomSource

func (c *Config) SetSecurityCustomSource(sources []string) error

func (*Config) SetSecurityRepoType

func (c *Config) SetSecurityRepoType(typ RepoType) error

func (*Config) SetSystemCustomSource

func (c *Config) SetSystemCustomSource(sources []string) error

func (*Config) SetSystemRepoType

func (c *Config) SetSystemRepoType(typ RepoType) error

func (*Config) SetUpdateMode

func (c *Config) SetUpdateMode(mode system.UpdateType) error

func (*Config) SetUpdateNotify

func (c *Config) SetUpdateNotify(enable bool) error

func (*Config) SetUpdateStatus

func (c *Config) SetUpdateStatus(status string) error

func (*Config) SetUpgradeStatusAndReason

func (c *Config) SetUpgradeStatusAndReason(status system.UpgradeStatusAndReason) error

func (*Config) SetUseDSettings

func (c *Config) SetUseDSettings(use bool) error

func (*Config) SetVersion

func (c *Config) SetVersion(version string) error

func (*Config) UpdateLastCheckCacheSizeTime

func (c *Config) UpdateLastCheckCacheSizeTime() error

func (*Config) UpdateLastCheckTime

func (c *Config) UpdateLastCheckTime() error

func (*Config) UpdateLastCleanTime

func (c *Config) UpdateLastCleanTime() error

func (*Config) UpdateLastoreDaemonStatus

func (c *Config) UpdateLastoreDaemonStatus(status LastoreDaemonStatus, isSet bool) error

UpdateLastoreDaemonStatus isSet: true 该位置1; false 该位清零

type DisabledStatus

type DisabledStatus uint32
const (
	DisabledUnknown         DisabledStatus = 1 << 0 // 禁用重启后的检查项,1063前的版本不兼容需要禁用 // 该配置项不作为配置生效
	DisabledVersion         DisabledStatus = 1 << 1 // 禁用version请求
	DisabledUpdateLog       DisabledStatus = 1 << 2 // 禁用systemupdatelogs请求
	DisabledTargetPkgLists  DisabledStatus = 1 << 3
	DisabledCurrentPkgLists DisabledStatus = 1 << 4
	DisabledPkgCVEs         DisabledStatus = 1 << 5
	DisabledProcess         DisabledStatus = 1 << 6
	DisabledResult          DisabledStatus = 1 << 7
	DisabledRebootCheck     DisabledStatus = 1 << 8 // 禁用重启后的检查项,1063前的版本不兼容需要禁用
)

type LastoreDaemonStatus

type LastoreDaemonStatus uint32

LastoreDaemonStatus 由于lastore-daemon会闲时退出,dde-session-shell和dde-control-center需要获取实时状态时需要从dconfig获取,而不是从lastore-daemon获取

const (
	CanUpgrade    LastoreDaemonStatus = 1 << 0 // 是否可以进行安装更新操作
	DisableUpdate LastoreDaemonStatus = 1 << 1 // 当前系统是否禁用了更新
	ForceUpdate   LastoreDaemonStatus = 1 << 2 // 关机强制更新
)

type OemRepoConfig

type OemRepoConfig struct {
	UpdateType     system.UpdateType
	RepoShowNameZh string `json:"RepoShowName_zh"`
	RepoShowNameEn string `json:"RepoShowName_en"`
	RepoUrl        []string
	// contains filtered or unexported fields
}

type RepoType

type RepoType string
const (
	OSDefaultRepo  RepoType = "UOS_DEFAULT"
	OemDefaultRepo RepoType = "OEM_DEFAULT"
	CustomRepo     RepoType = "CUSTOM"
)

func (RepoType) IsValid

func (r RepoType) IsValid() bool

func (RepoType) String

func (r RepoType) String() string

Jump to

Keyboard shortcuts

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