helpers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ExecLocationKey = "X-ExecLocation"

This key in the desktop files written by appimaged describes where the AppImage is in the filesystem. We need this because we rewrite Exec= to include things like wrap and Firejail

Variables

This section is empty.

Functions

func CalculateElfSize

func CalculateElfSize(file string) int64

CalculateElfSize returns the size of an ELF binary as an int64 based on the information in the ELF header

func CheckMagicAtOffset

func CheckMagicAtOffset(f *os.File, magic string, offset int64) bool

Return true if magic string (hex) is found at offset TODO: Instead of magic string, could probably use something like []byte{'\r', '\n'} or []byte("AI")

func FindMostRecentFile

func FindMostRecentFile(files []string) string

FindMostRecentFile returns the most recent file from a slice of files, (currently) based on its mtime based on https://stackoverflow.com/a/45579190 TODO: mtime may be fast, but is it "good enough" for our purposes?

func GetSectionData

func GetSectionData(filepath string, name string) ([]byte, error)

GetSectionData returns the contents of an ELF section and error

func LogError

func LogError(context string, e error)

LogError logs error, prefixed by a string that explains the context

func PrintError

func PrintError(context string, e error)

PrintError prints error, prefixed by a string that explains the context

func RunCmdStringTransparently

func RunCmdStringTransparently(command string) error

RunCmdStringTransparently works like RunCmdTransparently but accepts a string rather than a []string as its input. Why is this not part of the standard library?

func RunCmdTransparently

func RunCmdTransparently(command []string) error

RunCmdTransparently runs the command given in a []string and runs it transparently (stdin and stderr appear immediately while the command is running). Blocks until command has completed. Returns error. https://stackoverflow.com/a/31004293 https://stackoverflow.com/q/33452726 Why is this not part of the standard library?

func ValidateUpdateInformation

func ValidateUpdateInformation(updateinformation string) error

ValidateUpdateInformation validates an updateinformation string, returns error. TODO: Build this into NewUpdateInformationFromString and get rid of it?

Types

type UpdateInformation

type UpdateInformation struct {
	// contains filtered or unexported fields
}

Please note that pre-releases are not being considered when using "latest". You will have to explicitly provide the name of a release. When using e.g., uploadtool, the name of the release created will always be "continuous", hence, you can just specify that value instead of "latest".

func NewUpdateInformationFromString

func NewUpdateInformationFromString(updateinformation string) (UpdateInformation, error)

NewUpdateInformationFromString returns an UpdateInformation struct for the given updateinformation string, and err TODO: Use UpdateInformation structs throughout the codebase

Jump to

Keyboard shortcuts

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