config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

CLI Configuration

The Fresnel CLI obtains all information for the distributions it makes available from deafults.go.

Distributions

Distributions defines collections of related installers. In general, this refers to operating system families (windows, linux) but can also refer to a collection of utility installers, such as recovery disks.

Adding a map within entry to distributions within defaults.go adds a distribution for the cli to use.

Distribution

A distribution defines the specific installer you wish to make available.

  type distribution struct {
      os          OperatingSystem // windows or linux
      name        string // Friendly name: e.g. Corp Windows.
      label       string // If set, is used to set partition labels.
      seedServer  string // If set, a seed is obtained from here.
      seedFile    string // This file is hashed when obtaing a seed.
      seedDest    string // The relative path where the seed should be written.
      imageServer string // The base image is obtained here.
      images      map[string]string
  }
Behaviors with specific fields
  • label - Sets the data partition of the installation media is this value.
  • seedServer - When configured, the CLI will attempt to retrieve a seed from your App Engine instance. See the appengine documentation for more information on seeds.
  • seedFile - When configured, this file is hashed and the hash send with the seed request.
  • seedDest - The relative path on the installation media where the seed should be written.
  • imageServer - The root path to the webserver that houses installation media images.
Images

Images are defined within a distribution. Think of them as a set of variants for an image. For example, you may have a stable and unstable installer for windows. They are represented by a map of strings with the key being the label and the value representing the relative path of the image file under imageServer.

Example

The following example is a valid configuration.

 var distributions = map[string]distribution{
 "windows": distribution{
      os:          windows,
      label:       "INSTALLER",
      name:        "windows",
        seedServer:  "https://appengine.address.com/seed",
        seedFile:    "sources/boot.wim",
        seedDest:    "seed",
        imageServer: "https://image.host.com/folder",
        images: map[string]string{
      "default": "installer_img.iso",
        },
    },
    "linux": distribution{
      os:          linux,
      name:        "linux",
      imageServer: "",
        images: map[string]string{
          "default": "installer.img.gz",
      },
     },
 }

Documentation

Overview

Package config parses flags and returns a configuration for imaging a usb

Index

Constants

This section is empty.

Variables

View Source
var (
	// IsElevatedCmd injects the command to determine the elevation state of the
	// user context.
	IsElevatedCmd = isRoot
)

Functions

This section is empty.

Types

type Configuration

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

Configuration represents the state of all flags and selections provided by the user when the binary is invoked.

func New

func New(cleanup, warning, eject, ffu, update bool, devices []string, os, track, seedServer string) (*Configuration, error)

New generates a new configuration from flags passed on the command line. It performs sanity checks on those parameters.

func (*Configuration) Cleanup

func (c *Configuration) Cleanup() bool

Cleanup returns whether or not the cleanup of temp files was requested by flag.

func (*Configuration) ConfFile

func (c *Configuration) ConfFile() string

ConfFile returns the final name of the configuration file.

func (*Configuration) Devices

func (c *Configuration) Devices() []string

Devices returns the devices to be provisioned.

func (*Configuration) Distro

func (c *Configuration) Distro() string

Distro returns the name of the selected distribution, or blank if none has been selected.

func (*Configuration) DistroLabel

func (c *Configuration) DistroLabel() string

DistroLabel returns the label that should be used for media provisioned with the selected distribution. Can be empty.

func (*Configuration) Elevated

func (c *Configuration) Elevated() bool

Elevated identifies if the user is running the binary with elevated permissions.

func (*Configuration) FFU

func (c *Configuration) FFU() bool

FFU returns whether or not to place the SFU files after provisioning.

func (*Configuration) FileName

func (c *Configuration) FileName() string

FileName returns the name of the config file.

func (*Configuration) Image

func (c *Configuration) Image() string

Image returns the full path to the raw image for this configuration.

func (*Configuration) ImageFile

func (c *Configuration) ImageFile() string

ImageFile returns the filename of the raw image for this configuration.

func (*Configuration) Path

func (c *Configuration) Path() string

Path returns the path to the config.

func (*Configuration) PowerOff

func (c *Configuration) PowerOff() bool

PowerOff returns whether or not devices should be powered off after write operations.

func (*Configuration) SFUDest

func (c *Configuration) SFUDest() string

SFUDest returns the relative path where the SFU files should be written.

func (*Configuration) SFUManifest

func (c *Configuration) SFUManifest() string

SFUManifest returns the filename of the SFU manifest file for this configuration.

func (*Configuration) SFUPath

func (c *Configuration) SFUPath() string

SFUPath returns the path to the SFU manifest.

func (*Configuration) SeedDest

func (c *Configuration) SeedDest() string

SeedDest returns the relative path where a seed should be written.

func (*Configuration) SeedFile

func (c *Configuration) SeedFile() string

SeedFile returns the path to the file that is to be hashed when obtaining a seed.

func (*Configuration) SeedServer

func (c *Configuration) SeedServer() string

SeedServer returns the configured seed server for the chosen distribution.

func (*Configuration) String

func (c *Configuration) String() string

String implements the fmt.Stringer interface. This allows config to be passed to logging for a human-readable display of the selected configuration.

func (*Configuration) Track

func (c *Configuration) Track() string

Track returns the selected track of the installer image. This generally maps to one of default, unstable, testing, or stable.

func (*Configuration) UpdateDevices

func (c *Configuration) UpdateDevices(newDevices []string)

UpdateDevices updates the list of devices to be provisioned.

func (*Configuration) UpdateOnly

func (c *Configuration) UpdateOnly() bool

UpdateOnly returns whether only an update is being requested.

func (*Configuration) Warning

func (c *Configuration) Warning() bool

Warning returns whether or not a warning should be presented prior to destructive operations.

type OperatingSystem

type OperatingSystem string

OperatingSystem is used to indicate the OS of the media to be generated.

Jump to

Keyboard shortcuts

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