mirror of
https://github.com/containers/podman.git
synced 2025-12-02 11:08:36 +08:00
Vendor Bulidah 1.11.2
Vendor in Buildah 1.11.2 into libpod/Podman Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
This commit is contained in:
33
vendor/github.com/containers/buildah/run_linux.go
generated
vendored
33
vendor/github.com/containers/buildah/run_linux.go
generated
vendored
@@ -36,6 +36,7 @@ import (
|
||||
"github.com/docker/libnetwork/types"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/opencontainers/runtime-tools/generate"
|
||||
"github.com/opencontainers/selinux/go-selinux/label"
|
||||
"github.com/pkg/errors"
|
||||
@@ -121,6 +122,20 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
g.SetProcessArgs(nil)
|
||||
}
|
||||
|
||||
for _, d := range b.Devices {
|
||||
sDev := spec.LinuxDevice{
|
||||
Type: string(d.Type),
|
||||
Path: d.Path,
|
||||
Major: d.Major,
|
||||
Minor: d.Minor,
|
||||
FileMode: &d.FileMode,
|
||||
UID: &d.Uid,
|
||||
GID: &d.Gid,
|
||||
}
|
||||
g.AddDevice(sDev)
|
||||
g.AddLinuxResourcesDevice(true, string(d.Type), &d.Major, &d.Minor, d.Permissions)
|
||||
}
|
||||
|
||||
setupMaskedPaths(g)
|
||||
setupReadOnlyPaths(g)
|
||||
|
||||
@@ -181,6 +196,24 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
}
|
||||
bindFiles["/etc/resolv.conf"] = resolvFile
|
||||
}
|
||||
// Empty file, so no need to recreate if it exists
|
||||
if _, ok := bindFiles["/run/.containerenv"]; !ok {
|
||||
// Empty string for now, but we may consider populating this later
|
||||
containerenvPath := filepath.Join(path, "/run/.containerenv")
|
||||
if err = os.MkdirAll(filepath.Dir(containerenvPath), 0755); err != nil && !os.IsExist(err) {
|
||||
return err
|
||||
}
|
||||
emptyFile, err := os.Create(containerenvPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
emptyFile.Close()
|
||||
if err := label.Relabel(containerenvPath, b.MountLabel, false); err != nil {
|
||||
return errors.Wrapf(err, "error relabeling %q in container %q", containerenvPath, b.ContainerID)
|
||||
}
|
||||
|
||||
bindFiles["/run/.containerenv"] = containerenvPath
|
||||
}
|
||||
|
||||
err = b.setupMounts(mountPoint, spec, path, options.Mounts, bindFiles, volumes, b.CommonBuildOpts.Volumes, b.CommonBuildOpts.ShmSize, namespaceOptions)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user