Blame internal/osbuild/fstab_stage.go

Packit Service 4d2de5
package osbuild
Packit Service 4d2de5
Packit Service 4d2de5
// The FSTabStageOptions describe the content of the /etc/fstab file.
Packit Service 4d2de5
//
Packit Service 4d2de5
// The structure of the options follows the format of /etc/fstab, except
Packit Service 4d2de5
// that filesystem must be identified by their UUID and ommitted fields
Packit Service 4d2de5
// are set to their defaults (if possible).
Packit Service 4d2de5
type FSTabStageOptions struct {
Packit Service 4d2de5
	FileSystems []*FSTabEntry `json:"filesystems"`
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
func (FSTabStageOptions) isStageOptions() {}
Packit Service 4d2de5
Packit Service 4d2de5
// NewFSTabStage creates a now FSTabStage object
Packit Service 4d2de5
func NewFSTabStage(options *FSTabStageOptions) *Stage {
Packit Service 4d2de5
	return &Stage{
Packit Service 4d2de5
		Name:    "org.osbuild.fstab",
Packit Service 4d2de5
		Options: options,
Packit Service 4d2de5
	}
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// An FSTabEntry represents one line in /etc/fstab. With the one exception
Packit Service 4d2de5
// that the the spec field must be represented as an UUID.
Packit Service 4d2de5
type FSTabEntry struct {
Packit Service 4d2de5
	UUID    string `json:"uuid,omitempty"`
Packit Service 4d2de5
	Label   string `json:"label,omitempty"`
Packit Service 4d2de5
	VFSType string `json:"vfs_type"`
Packit Service 4d2de5
	Path    string `json:"path,omitempty"`
Packit Service 4d2de5
	Options string `json:"options,omitempty"`
Packit Service 4d2de5
	Freq    uint64 `json:"freq,omitempty"`
Packit Service 4d2de5
	PassNo  uint64 `json:"passno,omitempty"`
Packit Service 4d2de5
}
Packit Service 4d2de5
Packit Service 4d2de5
// AddFilesystem adds one entry to and FSTabStageOptions object.
Packit Service 4d2de5
func (options *FSTabStageOptions) AddFilesystem(id string, vfsType string, path string, opts string, freq uint64, passNo uint64) {
Packit Service 4d2de5
	options.FileSystems = append(options.FileSystems, &FSTabEntry{
Packit Service 4d2de5
		UUID:    id,
Packit Service 4d2de5
		VFSType: vfsType,
Packit Service 4d2de5
		Path:    path,
Packit Service 4d2de5
		Options: opts,
Packit Service 4d2de5
		Freq:    freq,
Packit Service 4d2de5
		PassNo:  passNo,
Packit Service 4d2de5
	})
Packit Service 4d2de5
}