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,20 +188,21 @@ 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 {
return mount, err
}
mount.Source = mergeDir
mount.Destination = dest
mount.Type = "bind"
mount.Options = []string{"bind", "slave"}
return mount, nil
mountProgram := findMountProgram(opts.GraphOpts)
if mountProgram != "" {
if err := mountWithMountProgram(mountProgram, overlayOptions, mergeDir); err != nil {
return mount, err
}
/* If a mount_program is not specified, fallback to try mount native overlay. */
mount.Source = mergeDir
mount.Destination = dest
mount.Type = "bind"
mount.Options = []string{"bind", "slave"}
return mount, nil
}
if unshare.IsRootless() {
/* If a mount_program is not specified, fallback to try mounting native overlay. */
overlayOptions = fmt.Sprintf("%s,userxattr", overlayOptions)
}