Documentation
¶
Overview ¶
Package firstboot provides a service that runs scripts once on first boot. You can easily test this with:
mkdir /tmp/mgmt-firstboot/ ; echo 'echo hello' > /tmp/mgmt-firstboot/foo.sh ./mgmt firstboot start --lock-file-path=/tmp/flock.lock \ --scripts-dir=/tmp/mgmt-firstboot/ --logging-dir=/tmp/
Index ¶
Constants ¶
const ( // LockFilePath is where we store a lock file to prevent more than one // copy of this service running at the same time. // TODO: Is there a better place to put this? LockFilePath string = "/var/lib/mgmt/firstboot.lock" // ScriptsDir is the directory where firstboot scripts can be found. You // can put binaries in here too. Contents must be executable. ScriptsDir string = "/var/lib/mgmt/firstboot/" // StyleSuffix is what we append to executables to specify a style file. StyleSuffix = ".yaml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
}
Config is a struct of all the configuration values which are shared by all of the setup utilities. By including this as a separate struct, it can be used as part of the API if we want.
type Start ¶
type Start struct {
*cliUtil.FirstbootStartArgs // embedded config
Config // embedded Config
// Program is the name of this program, usually set at compile time.
Program string
// Version is the version of this program, usually set at compile time.
Version string
// Debug represents if we're running in debug mode or not.
Debug bool
// Logf is a logger which should be used.
Logf func(format string, v ...interface{})
}
Start is the standalone entry program for the firstboot start component.
func (*Start) Run ¶
Run performs the desired actions. This runs a list of scripts and then removes them. This is useful for a "firstboot" service. If there exists a file with the same name as an executable script or binary, but which has a .yaml extension, that will be parsed to look for command modifiers.
type Style ¶
type Style struct {
// DoneDir specifies the dir to move files to instead of deleting them.
DoneDir string `yaml:"done-dir"`
// KeepOnFail should be true to preserve the script if it fails. This
// means it will likely run again the next time the service runs.
KeepOnFail bool `yaml:"keep-on-fail"`
// NoLog should be true to skip logging the output of this command.
NoLog bool `yaml:"no-log"`
// contains filtered or unexported fields
}
Style are some values that are used to specify how each command runs.