Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version of PrepPi. Usually overridden at build time. Version = "0.1.dev" // BuildID of PrepPi. Usually overridden at build time. BuildID = "dev" )
var RebootCommand = "/sbin/reboot"
RebootCommand is the path to the command to execute to reboot the machine.
Functions ¶
func Fingerprint ¶
fingerprint checksums the file and its relavent metadata for PrepPi. TODO(cfunkhouser): UID/GID
func MapperToFile ¶
MapperToFile marshals m to path as JSON.
func VersionString ¶
func VersionString() string
VersionString returnds a human-readable PrepPi version ID.
Types ¶
type BasePathFs ¶
type BasePathFs struct { *afero.BasePathFs // contains filtered or unexported fields }
BasePathFs extends afero.BasePathFs with some things needed by PrepPi.
type Fs ¶
type Fs interface { afero.Fs // Chown changes the numeric uid and gid of the named file. Chown(name string, uid, gid int) error }
Fs represents a file system with which PrepPi will interact. It extends afero.Fs with a few functions we need but which are not supplied there.
func NewBasePathFs ¶
NewBasePathFs creates and return a BasePathFs instance.
type Ingredient ¶
type Ingredient struct { Source string `json:"source"` Destination string `json:"destination"` Mode os.FileMode `json:"mode"` DirMode os.FileMode `json:"dirmode"` UID int `json:"uid"` GID int `json:"gid"` Clobber bool `json:"clobber,omitempty"` Vars []string `json:"vars"` }
func (*Ingredient) Mapping ¶
func (i *Ingredient) Mapping() *Mapping
func (*Ingredient) Prepare ¶
func (i *Ingredient) Prepare(srcRoot, destRoot string, d *RecipeData) error
type Mapper ¶
type Mapper struct {
Mappings []*Mapping `json:"map"`
}
Mapper represents a set of file mappings.
func MapperFromConfig ¶
MapperFromConfig reads a config and returns a Mapper
type Mapping ¶
type Mapping struct { Source string `json:"source"` Destination string `json:"destination"` Mode os.FileMode `json:"mode"` DirMode os.FileMode `json:"dirmode"` UID int `json:"uid"` GID int `json:"gid"` // Clobber is true when it's okay to overrwite Destination if it exists. Clobber bool `json:"clobber,omitempty"` }
Mapping represents a file mapped from the Source to Destination. Mode, UID and GID apply to the written Destination file. DirMode is applied to any directories created.
type MemMapFs ¶
MemMapFs extends afero.MemMapFs with some things needed by PrepPi.
type Recipe ¶
type Recipe struct { Name string `json:"name"` Ingredients []*Ingredient `json:"ingredients"` // contains filtered or unexported fields }
func RecipeFromFile ¶
RecipeFromFile reads a config and returns a Mapper
type RecipeData ¶
RecipeData is a data structure used to execute templates when generating files for the recipe.
func (*RecipeData) GeneratedByPrepPi ¶
func (r *RecipeData) GeneratedByPrepPi() string
GeneratedByPrepPi returns a string of the format: "Generated by PrepPi $VERSION ($BUILD_ID)"