Blame internal/osbuild1/fstab_stage.go

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