osbuild2: new stages

org.osbuild.chmod: runs chmod on one or more files
org.osbuild.nginx.conf: write nginx config file

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
Achilleas Koutsou 2021-04-30 18:28:13 +02:00 committed by Tom Gundersen
parent 6abb4b9af6
commit a717a7245b
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,20 @@
package osbuild2
type ChmodStageOptions struct {
Items map[string]ChmodStagePathOptions `json:"items"`
}
type ChmodStagePathOptions struct {
Mode string `json:"mode"`
Recursive bool `json:"recursive,omitempty"`
}
func (ChmodStageOptions) isStageOptions() {}
// NewChmodStage creates a new org.osbuild.chmod stage
func NewChmodStage(options *ChmodStageOptions) *Stage {
return &Stage{
Type: "org.osbuild.chmod",
Options: options,
}
}

View file

@ -0,0 +1,32 @@
package osbuild2
type NginxConfigStageOptions struct {
// Config file location
Path string `json:"path,omitempty"`
Config *NginxConfig `json:"config,omitempty"`
}
func (NginxConfigStageOptions) isStageOptions() {}
type NginxConfig struct {
// The address and/or port on which the server will accept requests
Listen string `json:"listen,omitempty"`
// The root directory for requests
Root string `json:"root,omitempty"`
// File that will store the process ID of the main process
PID string `json:"pid,omitempty"`
// Whether nginx should become a daemon
Daemon *bool `json:"daemon,omitempty"`
}
// NewNingxConfigStage creates a new org.osbuild.nginxconfig stage
func NewNginxConfigStage(options *NginxConfigStageOptions) *Stage {
return &Stage{
Type: "org.osbuild.nginx.conf",
Options: options,
}
}