core

package
v0.0.0-...-1ae2f49 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TasksLocation = "/.config/vso/tasks"
	CurrentQueue  = []Task{}
)
View Source
var APKCacheDir = fmt.Sprintf("%s/.cache/vso/apks/", os.Getenv("HOME"))
View Source
var DatabasePath = fmt.Sprintf("%s/.local/share/vso/waydroid/droidapps.db", os.Getenv("HOME"))
View Source
var IndexCacheDir = fmt.Sprintf("%s/.cache/vso/indexes/", os.Getenv("HOME"))
View Source
var Indexes []os.DirEntry
View Source
var ProcessPath string
View Source
var Repositories []FdroidRepo

Functions

func AreABRootTransactionsLocked

func AreABRootTransactionsLocked() bool

AreABRootTransactionsLocked checks if there are any abroot transactions currently running

func AskConfirmation

func AskConfirmation(s string, norm bool) bool

func CheckConnection

func CheckConnection() bool

func ConfirmWindow

func ConfirmWindow(title string, body string) bool

func CreateVsoTable

func CreateVsoTable(writer io.Writer) *tablewriter.Table

func DeleteTaskByUnitName

func DeleteTaskByUnitName(name string) error

DeleteTaskByUnitName deletes a task

func EnsureWayStarted

func EnsureWayStarted() error

func FetchPackage

func FetchPackage(match FdroidPackage) (string, error)

func GetBatteryStats

func GetBatteryStats() (bool, bool, bool)

GetBatteryStats gets the battery stats

func GetCPUTemp

func GetCPUTemp() int

GetCPUTemp gets the CPU temperature

func GetPackageVersion

func GetPackageVersion(pkg FdroidPackage) (string, error)

func GetPico

func GetPico() (*core.SubSystem, error)

func GetRepos

func GetRepos() error

func GetWay

func GetWay() (*core.SubSystem, error)

func GetWayDatabase

func GetWayDatabase() (*bolt.DB, error)

func HasUpdates

func HasUpdates() (bool, error)

HasUpdates checks if the system has updates available

func IsCPUUnderHighUsage

func IsCPUUnderHighUsage() (bool, int)

IsCPUUnderHighUsage checks if the CPU is being used (false if exceeds 50%)

func IsInternetUnderHighUsage

func IsInternetUnderHighUsage() (bool, int)

IsInternetUnderHighUsage checks if the internet is being used (false if exceeds 500kb/s)

func IsLaptop

func IsLaptop() bool

IsLaptop checks if the system is a laptop by looking for the chassis type

func IsMemoryUnderHighUsage

func IsMemoryUnderHighUsage() (bool, int)

IsMemoryUnderHighUsage checks if the memory is being used (false if exceeds 50%)

func IsMeteredConnection

func IsMeteredConnection() bool

IsMeteredConnection checks if the connection is metered

func IsNetworkUp

func IsNetworkUp() bool

IsNetworkUp checks if the network is up

func IsSupported

func IsSupported() int

func ItsBeen

func ItsBeen(last time.Time, duration string) bool

ItsBeen checks if it's been a certain amount of time since the last time

func ItsTime

func ItsTime(targetTime string) bool

ItsTime checks if it's a certain time of day

func ListTasksJson

func ListTasksJson() (string, error)

ListTasksJson lists all tasks with detailed information in JSON format

func ListUnitTasks

func ListUnitTasks() ([]string, error)

ListUnitTasks lists all tasks files

func NeedUpdate

func NeedUpdate() bool

NeedUpdate checks if the system needs to be updated according to the latest update log compared to the VSO configuation

func PickOption

func PickOption(s string, a []string, def int) int

func PicoDelete

func PicoDelete() error

func PicoExists

func PicoExists() bool

func PicoExport

func PicoExport(app string, binary string) error

func PicoInit

func PicoInit() error

func PicoUnexport

func PicoUnexport(app string, binary string) error

func PicoUpgrade

func PicoUpgrade() error

func RootCheck

func RootCheck(display bool) bool

func RotateTasks

func RotateTasks(event string) error

RotateTasks checks if no other rotators are running, then performs initial checks and starts rotating every 5 seconds

func RunTaskByUnitName

func RunTaskByUnitName(name string) error

RunTaskByUnitName runs a task

func RunUpgradeCheck

func RunUpgradeCheck() error

RunUpgradeCheck asks ABRoot to check for updates and passes its output to stdout

func RunUpgradeCheckJSON

func RunUpgradeCheckJSON() (bool, error)

RunUpgradeCheckJSON asks ABRoot to check for updates and return a JSON-formatted result

func SendNotification

func SendNotification(title, body string) error

func SmartUpdate

func SmartUpdate() bool

SmartUpdate checks if the device is currently being used, then returns true if the device is not being used

func SyncIndex

func SyncIndex(force bool, downTrans string) error

func TaskHasRun

func TaskHasRun(name string) bool

TaskHasRun checks if a task has run in the current queue

func TaskHasRunFail

func TaskHasRunFail(name string) bool

TaskHasRunFail checks if a task has run unsuccessfully in the current queue

func TaskHasRunSuccess

func TaskHasRunSuccess(name string) bool

TaskHasRunSuccess checks if a task has run successfully in the current queue

func TasksInit

func TasksInit() error

TasksInit calls makeTasksLocation and makeTasksRotatorAutostart in one call

func TryUpdate

func TryUpdate(force bool) error

TryUpdate tries to update the system via ABRoot

func WayDelete

func WayDelete() error

func WayExists

func WayExists() bool

func WayInit

func WayInit() error

func WayLXCStart

func WayLXCStart() error

func WayLXCStop

func WayLXCStop() error

func WayPutAppIntoDatabase

func WayPutAppIntoDatabase(pkg FdroidPackage, db *bolt.DB) error

func WayRemoveAppFromDatabase

func WayRemoveAppFromDatabase(rdnsname string, db *bolt.DB) error

func WaySessionStart

func WaySessionStart() error

Types

type BucketNotFoundError

type BucketNotFoundError struct {
	BucketName string
	Err        error
}

func (*BucketNotFoundError) Error

func (b *BucketNotFoundError) Error() string

type CommonChecks

type CommonChecks struct {
	Network           bool
	Battery           bool
	LowBattery        bool
	FullBattery       bool
	IsLaptop          bool
	HighInternetUsage bool
	InternetUsage     int
	MeteredConnection bool
	HighMemoryUsage   bool
	MemoryUsage       int
	HighCPUUsage      bool
	CPUUsage          int
	CPUTemp           int
}

func GetCommonChecks

func GetCommonChecks() *CommonChecks

GetCommonChecks checks network and battery

type FdroidPackage

type FdroidPackage struct {
	Name                 string
	RDNSName             string
	Summary              string
	Author               string
	Source               string
	License              string
	InstalledVersionCode int
	Repository           FdroidRepo
	Versions             []byte
}

func SearchIndex

func SearchIndex(search string, downTrans string) ([]FdroidPackage, error)

func WayGetAppFromDatabase

func WayGetAppFromDatabase(rdnsname string, db *bolt.DB) (FdroidPackage, error)

type FdroidRepo

type FdroidRepo struct {
	Name           string
	Key            string
	IndexURL       string
	RepoURL        string
	PackageURL     string
	PackageInfoURL string
}

type InstallDeclined

type InstallDeclined struct{}

func (*InstallDeclined) Error

func (i *InstallDeclined) Error() string

type NoMatchError

type NoMatchError struct {
	Search string
	Err    error
}

func (*NoMatchError) Error

func (n *NoMatchError) Error() string

type PackageInCache

type PackageInCache struct {
	Name string
	Err  error
}

func (*PackageInCache) Error

func (p *PackageInCache) Error() string

type Task

type Task struct {
	Name        string
	Slug        string
	Description string
	NeedConfirm bool
	Command     string

	AfterTask        string
	AfterTaskSuccess string
	AfterTaskFailure string
	Every            string
	At               string
	//OnBoot               bool
	OnNetwork            bool
	OnDisconnect         bool
	OnBattery            bool
	OnLowBattery         bool
	OnCharge             bool
	OnFullBattery        bool
	OnConditionCommand   string
	OnProcess            string
	OnInternetUsage      int
	OnHighInternetUsage  bool
	OnMemoryUsage        int
	OnHighMemoryUsage    bool
	OnCPUUsage           int
	OnHighCPUUsage       bool
	OnCPUTemp            int
	OnDeviceConnected    string
	OnDeviceDisconnected string

	LastExecution       time.Time
	LastExecutionOutput string
}

func ListTasksDetailed

func ListTasksDetailed() ([]Task, error)

ListTasksDetailed lists all tasks with detailed information

func LoadTaskByUnitName

func LoadTaskByUnitName(name string) (*Task, error)

LoadTaskByUnitName loads a task

func (*Task) Delete

func (t *Task) Delete() error

Delete deletes a task

func (*Task) Dependencies

func (t *Task) Dependencies() []Task

Dependencies returns a list of Task which the current one depends on

func (*Task) IsRunning

func (t *Task) IsRunning() bool

IsRunning checks if a task is running

func (*Task) Relations

func (t *Task) Relations() []Task

Relations returns a list of Task which depends on the current one

func (*Task) RemoveLastFailure

func (t *Task) RemoveLastFailure() error

RemoveLastFailure removes the last failure of a task in /tmp

func (*Task) RemoveLastSuccess

func (t *Task) RemoveLastSuccess() error

RemoveLastSuccess removes the last success of a task in /tmp

func (*Task) RemoveRunning

func (t *Task) RemoveRunning() error

RemoveRunning removes the running state of a task in /tmp

func (*Task) Run

func (t *Task) Run() error

Run runs a task

func (*Task) Save

func (t *Task) Save() error

Save saves a task in a vsotask file

func (*Task) SaveLastFailure

func (t *Task) SaveLastFailure() error

SaveLastFailure saves the last failure of a task in /tmp

func (*Task) SaveLastSuccess

func (t *Task) SaveLastSuccess() error

SaveLastSuccess saves the last success of a task in /tmp

func (*Task) SaveRunning

func (t *Task) SaveRunning() error

SaveRunning saves the running state of a task in /tmp

func (*Task) ShouldRun

func (t *Task) ShouldRun(cChecks *CommonChecks, event string) bool

ShouldRun checks if a task respect the assigned event/condition

func (*Task) Target

func (t *Task) Target() string

Target returns the target of the task

func (*Task) Unit

func (t *Task) Unit() string

Unit returns the unit name of a task

func (*Task) WasFailure

func (t *Task) WasFailure() bool

WasFailure checks if a task was a failure

func (*Task) WasSuccessful

func (t *Task) WasSuccessful() bool

WasSuccessful checks if a task was successful

type TaskJson

type TaskJson struct {
	Task
	Dependencies []Task `json:"Dependencies"`
	Relations    []Task `json:"Relations"`
	Target       string `json:"Target"`
}

Jump to

Keyboard shortcuts

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