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 ¶
- func BoardHelp() string
- func FindPublicKey() string
- func Flash(imgPath, disk string) error
- func GetCountry() string
- func GetSetupSH() []byte
- func GetTimeLocation() string
- func ListSDCards() []string
- func ManufacturerHelp() string
- func Mount(disk string, n int) (string, error)
- func Umount(disk string) error
- type Board
- type Distro
- type Manufacturer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPublicKey ¶
func FindPublicKey() string
FindPublicKey returns the absolute path to a public key for the user, if any.
func Flash ¶
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.
Types ¶
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) DefaultHostname ¶
DefaultHostname returns the default hostname as set by the image.
func (*Distro) DefaultUser ¶
DefaultUser returns the default user account created by the image.
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) String ¶
func (m *Manufacturer) String() string