osbuild/mkdir: make Mode a pointer

The default value for the `os.FileMode` is zero, but the actual default
value used by the stage if no value is specified in the options is
`0777`. By using the pointer, we'll allow one to specify `0000`
permissions as a value which won't be omitted from the stage options.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-01-18 17:35:44 +01:00 committed by Achilleas Koutsou
parent c1c26b2817
commit 8d0f2d7e79
2 changed files with 5 additions and 5 deletions

View file

@ -93,7 +93,7 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
Paths: []osbuild.MkdirStagePath{
{
Path: "/boot/efi",
Mode: os.FileMode(0700),
Mode: common.ToPtr(os.FileMode(0700)),
},
},
}))

View file

@ -8,10 +8,10 @@ type MkdirStageOptions struct {
}
type MkdirStagePath struct {
Path string `json:"path"`
Mode os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777
Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed
ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists
Path string `json:"path"`
Mode *os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777
Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed
ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists
}
func (MkdirStageOptions) isStageOptions() {}