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 DistroHelp() 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 Image
- type Manufacturer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DistroHelp ¶ added in v1.0.1
func DistroHelp() string
DistroHelp generates the help for Distro.
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 Board ¶
type Board string
Board is a board from a brand manufacturer.
const ( // OdroidC1 is a board sold by HardKernel. OdroidC1 Board = "odroidc1" // RaspberryPi is a series of boards sold by Raspberry. RaspberryPi Board = "raspberrypi" // CHIP used to be sold by NextThingCo. CHIP Board = "chip" // CHIPPro used to be sold by NextThingCo. CHIPPro Board = "chippro" // PocketCHIP used to be sold by NextThingCo. PocketCHIP Board = "pocketchip" )
type Distro ¶
type Distro string
Distro is an OS distribution.
const ( // Debian is https://www.debian.org/ Debian Distro = "debian" // RaspiOS is Raspberry Pi OS Lite. // See https://www.raspberrypi.com/software/operating-systems/ RaspiOS Distro = "raspios" // RaspiOS64 is Raspberry Pi OS 64 Lite. // See https://www.raspberrypi.com/software/operating-systems/ RaspiOS64 Distro = "raspios64" // Ubuntu is https://ubuntu.com/ Ubuntu Distro = "ubuntu" )
type Image ¶ added in v1.0.1
type Image struct { Manufacturer Manufacturer Board Board Distro Distro }
Image is an image that can be used on a board by a manufacturer.
func (*Image) DefaultHostname ¶ added in v1.0.1
DefaultHostname returns the default hostname as set by the image.
func (*Image) DefaultUser ¶ added in v1.0.1
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" // Raspberry is Raspberry Pi foundation; https://www.raspberrypi.org/about/ Raspberry Manufacturer = "raspberrypi" // NextThingCo was a company at https://getchip.com NextThingCo Manufacturer = "ntc" )
func (*Manufacturer) String ¶
func (m *Manufacturer) String() string