img

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Overview

Package img implements OS image related functionality for micro computers.

It includes fetching images and flashing them on an SDCard.

It includes gathering environmental information, like the current country and location on the host to enable configuring the board with the same settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoardHelp

func BoardHelp() string

BoardHelp generates the help for Board.

func FindPublicKey

func FindPublicKey() string

FindPublicKey returns the absolute path to a public key for the user, if any.

func Flash

func Flash(imgPath, disk string) error

Flash flashes imgPath to disk.

Before flashing, it unmounts any partition mounted on disk.

func GetCountry

func GetCountry() string

GetCountry returns the automatically detected country.

WARNING: This causes an outgoing HTTP request.

func GetSetupSH

func GetSetupSH() []byte

GetSetupSH returns the content of setup.sh.

Returns nil in case of catastrophic error.

func GetTimeLocation

func GetTimeLocation() string

GetTimeLocation returns the time location, e.g. America/Toronto.

This is then used by Debian to figure out the right timezone (e.g. EST/EDT) based on the location via tables.

We didn't find a way on Windows to retrieve the local "time zone location" in expected format. In the meantime, "Etc/UTC" is returned on Windows.

func ListSDCards

func ListSDCards() []string

ListSDCards returns the SD cards found.

Returns nil in case of error.

func ManufacturerHelp

func ManufacturerHelp() string

ManufacturerHelp generates the help for Manufacturer.

func Mount

func Mount(disk string, n int) (string, error)

Mount mounts a partition number n on disk p and returns the mount path.

func Umount

func Umount(disk string) error

Umount unmounts all the partitions on disk 'disk'.

Types

type Board

type Board string

Board is a board from a brand manufacturer.

func (*Board) Set

func (b *Board) Set(s string) error

Set implements flag.Value.

func (*Board) String

func (b *Board) String() string

type Distro

type Distro struct {
	Manufacturer Manufacturer
	Board        Board
	Distro       string
}

Distro is an image that can be used on a board by a manufacturer.

func (*Distro) Check

func (d *Distro) Check() error

Check sets default values and confirm specified values.

func (*Distro) DefaultHostname

func (d *Distro) DefaultHostname() string

DefaultHostname returns the default hostname as set by the image.

func (*Distro) DefaultUser

func (d *Distro) DefaultUser() string

DefaultUser returns the default user account created by the image.

func (*Distro) Fetch

func (d *Distro) Fetch() (string, error)

Fetch fetches the distro image remotely.

Returns the absolute path to the file downloaded.

func (*Distro) String

func (d *Distro) String() string

type Manufacturer

type Manufacturer string

Manufacturer is a board brand manufacturer.

const (
	// HardKernel can be bought at http://hardkernel.com
	HardKernel Manufacturer = "hardkernel"
	// NextThingCo can be bought at https://getchip.com
	NextThingCo Manufacturer = "ntc"
	// RaspberryPi is Raspberry Pi foundation; https://www.raspberrypi.org/about/
	RaspberryPi Manufacturer = "raspberrypi"
)

func (*Manufacturer) Set

func (m *Manufacturer) Set(s string) error

Set implements flag.Value.

func (*Manufacturer) String

func (m *Manufacturer) String() string

Jump to

Keyboard shortcuts

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