Make sure builtin volumes have the correct label
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #339 Approved by: nalind
This commit is contained in:
parent
a99d5f0798
commit
38d3cddb0c
1
.papr.sh
1
.papr.sh
|
@ -23,6 +23,7 @@ dnf install -y \
|
||||||
libselinux-devel \
|
libselinux-devel \
|
||||||
libselinux-utils \
|
libselinux-utils \
|
||||||
make \
|
make \
|
||||||
|
openssl \
|
||||||
ostree-devel \
|
ostree-devel \
|
||||||
which
|
which
|
||||||
|
|
||||||
|
|
4
run.go
4
run.go
|
@ -12,6 +12,7 @@ import (
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/opencontainers/runtime-tools/generate"
|
"github.com/opencontainers/runtime-tools/generate"
|
||||||
|
"github.com/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
|
@ -134,6 +135,9 @@ func (b *Builder) setupMounts(mountPoint string, spec *specs.Spec, optionMounts
|
||||||
if err = os.MkdirAll(volumePath, 0755); err != nil {
|
if err = os.MkdirAll(volumePath, 0755); err != nil {
|
||||||
return errors.Wrapf(err, "error creating directory %q for volume %q in container %q", volumePath, volume, b.ContainerID)
|
return errors.Wrapf(err, "error creating directory %q for volume %q in container %q", volumePath, volume, b.ContainerID)
|
||||||
}
|
}
|
||||||
|
if err = label.Relabel(volumePath, b.MountLabel, false); err != nil {
|
||||||
|
return errors.Wrapf(err, "error relabeling directory %q for volume %q in container %q", volumePath, volume, b.ContainerID)
|
||||||
|
}
|
||||||
srcPath := filepath.Join(mountPoint, volume)
|
srcPath := filepath.Join(mountPoint, volume)
|
||||||
if err = copyFileWithTar(srcPath, volumePath); err != nil && !os.IsNotExist(err) {
|
if err = copyFileWithTar(srcPath, volumePath); err != nil && !os.IsNotExist(err) {
|
||||||
return errors.Wrapf(err, "error populating directory %q for volume %q in container %q using contents of %q", volumePath, volume, b.ContainerID, srcPath)
|
return errors.Wrapf(err, "error populating directory %q for volume %q in container %q using contents of %q", volumePath, volume, b.ContainerID, srcPath)
|
||||||
|
|
Loading…
Reference in New Issue