core

package
v0.0.0-...-e0e8c14 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 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 ProcessPath string

Functions

func AreABRootTransactionsLocked

func AreABRootTransactionsLocked() bool

AreABRootTransactionsLocked checks if there are any abroot transactions currently running

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 GetBatteryStats

func GetBatteryStats() (bool, bool, bool)

GetBatteryStats gets the battery stats

func GetCPUTemp

func GetCPUTemp() int

GetCPUTemp gets the CPU temperature

func GetPico

func GetPico() (*core.SubSystem, 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 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 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, silent bool) 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 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

Types

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 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