overlay: always honor mountProgram

if a mountProgram is specified, use it also in rootfull mode.

Closes: https://github.com/containers/buildah/issues/3281

[NO NEW TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2022-01-26 11:16:24 +01:00
parent 5a25fc6f83
commit 4d0eb18796
No known key found for this signature in database
GPG Key ID: 67E38F7A8BA21772
1 changed files with 14 additions and 13 deletions

View File

@ -188,7 +188,6 @@ func MountWithOptions(contentDir, source, dest string, opts *Options) (mount spe
overlayOptions = fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s,private", escapeColon(source), upperDir, workDir)
}
if unshare.IsRootless() {
mountProgram := findMountProgram(opts.GraphOpts)
if mountProgram != "" {
if err := mountWithMountProgram(mountProgram, overlayOptions, mergeDir); err != nil {
@ -201,7 +200,9 @@ func MountWithOptions(contentDir, source, dest string, opts *Options) (mount spe
mount.Options = []string{"bind", "slave"}
return mount, nil
}
/* If a mount_program is not specified, fallback to try mount native overlay. */
if unshare.IsRootless() {
/* If a mount_program is not specified, fallback to try mounting native overlay. */
overlayOptions = fmt.Sprintf("%s,userxattr", overlayOptions)
}