repo

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Latest = "latest"
	Stable = "stable"
)

Releases

View Source
const IoTItRepo = "https://cdn.isaax.io/iotit/versions.json"

IoTItRepo stores default iotit repo path

View Source
const S3Bucket = "https://cdn.isaax.io/iotit/versions.json"

S3Bucket stores default S3 bucket path

Variables

View Source
var ImageDir = filepath.Join(baseDir, "images")

ImageDir is a directory of the flashing images

View Source
var VboxDir = filepath.Join(baseDir, "virtualbox")

VboxDir is a directory of virtualboxes

Functions

func CheckDevicesRepository added in v0.4.0

func CheckDevicesRepository()

CheckDevicesRepository checks mapping.json for updates

func DownloadAsync

func DownloadAsync(repo Repository, wg *sync.WaitGroup) (string, *pb.ProgressBar, error)

DownloadAsync starts async download

func DownloadDevicesRepository

func DownloadDevicesRepository() error

DownloadDevicesRepository downloads new mapping.json from the cloud

func DownloadNewVersion

func DownloadNewVersion(name, version, dst string) (string, error)

DownloadNewVersion downloads the latest version based on the current release and skips this step if up to date

func GenMappingFile

func GenMappingFile() error

GenMappingFile generates mapping.json file

func GetAllRepos

func GetAllRepos() ([]string, error)

GetAllRepos returns all repo Names

func GetDevices added in v0.3.4

func GetDevices() []string

func GetIoTItVersionMD5

func GetIoTItVersionMD5(oss, arch, version string) (hash string, repoVersion string, err error)

GetIoTItVersionMD5 gets the latest version from the repo and checks if the new version is available

func IsVersionUpToDate

func IsVersionUpToDate(v1, v2 string) (bool, error)

IsVersionUpToDate checks if version is up to date

func SetPath

func SetPath(p string)

SetPath of the mapping.json file

Types

type DeviceCollection

type DeviceCollection struct {
	Devices []DeviceMapping `json:"Devices"`
	Version string          `json:"Version,omitempty"`
}

deviceCollection is a starting point of the collection of images

func GetRepo

func GetRepo() *DeviceCollection

GetRepo returns devices collection

type DeviceImage

type DeviceImage struct {
	URL   string `json:"URL"`
	Alias string `json:"Alias,omitempty"`
	Title string `json:"Title,omitempty"`
	User  string `json:"User,omitempty"`
	Pass  string `json:"Pass,omitempty"`
	Hash  string `json:"Hash,omitempty"`
}

DeviceImage contains url, title, username and password which are used after flashing

type DeviceMapping

type DeviceMapping struct {
	Name   string           `json:"Name"`
	Alias  string           `json:"Alias,omitempty"`
	Sub    []*DeviceMapping `json:"Sub,omitempty"`
	Images []DeviceImage    `json:"Images,omitempty"`
	Type   string

	Image DeviceImage
	// contains filtered or unexported fields
}

DeviceMapping is a collection of device, it sub-types and sets of images for these devices

func GetDeviceRepo

func GetDeviceRepo(device string) (*DeviceMapping, error)

GetDeviceRepo returns a devices repo. It checks the existence of mapping.json first then proceeds to the default variable

func (*DeviceMapping) Dir

func (d *DeviceMapping) Dir() string

Dir - returns directory of a local repo `.iotit/images/{name}`

func (*DeviceMapping) FindImage

func (d *DeviceMapping) FindImage(image string) error

FindImage - searches image in the repo

func (*DeviceMapping) GetImageTitles

func (d *DeviceMapping) GetImageTitles() []string

GetImageTitles returns array of image titles

func (*DeviceMapping) GetSubsNames

func (d *DeviceMapping) GetSubsNames() []string

GetSubsNames returns array of Names within a `Sub`

type GenericRepository

type GenericRepository struct {
	Version   string
	URL       string
	Directory string
}

GenericRepository is so generic

func (*GenericRepository) Dir

func (g *GenericRepository) Dir() string

Dir of generic repo

func (*GenericRepository) GetURL

func (g *GenericRepository) GetURL() string

GetURL of generic repo

func (*GenericRepository) GetVersion

func (g *GenericRepository) GetVersion() string

GetVersion of generic repo

func (*GenericRepository) Name

func (g *GenericRepository) Name() string

Name of generic repo

type Repository

type Repository interface {
	//version of latest distro
	GetVersion() string
	//url of distro
	GetURL() string
	//name of the latest distro file
	Name() string
	//base dir of repository
	Dir() string
}

Repository represents image repo

func NewGenericRepository

func NewGenericRepository(url, version string, dir string) Repository

NewGenericRepository creates new generic repo

func NewRepositoryVM

func NewRepositoryVM() (Repository, error)

NewRepositoryVM creates new repository for specified VM type

type VMRepo

type VMRepo struct {
	VMs struct {
		VM struct {
			Version string `json:"version"`
			URL     string `json:"url"`
			MD5Sum  string `json:"md5sum"`
		} `json:"vm-iotit"`
	} `json:"vms"`
}

VMRepo is a configuration entry for VM

func (VMRepo) Dir

func (VMRepo) Dir() string

Dir of VM

func (VMRepo) GetURL

func (v VMRepo) GetURL() string

GetURL of VM

func (VMRepo) GetVersion

func (v VMRepo) GetVersion() string

GetVersion of VM

func (VMRepo) Name

func (v VMRepo) Name() string

Name of VM

Jump to

Keyboard shortcuts

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