mirror of
https://github.com/containers/podman.git
synced 2025-12-04 12:17:34 +08:00
rootfs: Add support for rootfs-overlay and bump to buildah v1.22.1-0.202108
Allows users to specify a readonly rootfs with :O, in exchange podman will create a writable overlay. bump builah to v1.22.1-0.20210823173221-da2b428c56ce [NO TESTS NEEDED] Signed-off-by: flouthoc <flouthoc.git@gmail.com>
This commit is contained in:
25
vendor/github.com/containers/buildah/pkg/overlay/overlay.go
generated
vendored
25
vendor/github.com/containers/buildah/pkg/overlay/overlay.go
generated
vendored
@@ -20,7 +20,6 @@ import (
|
||||
|
||||
// TempDir generates an overlay Temp directory in the container content
|
||||
func TempDir(containerDir string, rootUID, rootGID int) (string, error) {
|
||||
|
||||
contentDir := filepath.Join(containerDir, "overlay")
|
||||
if err := idtools.MkdirAllAs(contentDir, 0700, rootUID, rootGID); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay %s directory", contentDir)
|
||||
@@ -30,20 +29,36 @@ func TempDir(containerDir string, rootUID, rootGID int) (string, error) {
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay tmpdir in %s directory", contentDir)
|
||||
}
|
||||
upperDir := filepath.Join(contentDir, "upper")
|
||||
workDir := filepath.Join(contentDir, "work")
|
||||
|
||||
return generateOverlayStructure(contentDir, rootUID, rootGID)
|
||||
}
|
||||
|
||||
// GenerateStructure generates an overlay directory structure for container content
|
||||
func GenerateStructure(containerDir, containerID, name string, rootUID, rootGID int) (string, error) {
|
||||
contentDir := filepath.Join(containerDir, "overlay-containers", containerID, name)
|
||||
if err := idtools.MkdirAllAs(contentDir, 0700, rootUID, rootGID); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay %s directory", contentDir)
|
||||
}
|
||||
|
||||
return generateOverlayStructure(contentDir, rootUID, rootGID)
|
||||
}
|
||||
|
||||
// generateOverlayStructure generates upper, work and merge directory structure for overlay directory
|
||||
func generateOverlayStructure(containerDir string, rootUID, rootGID int) (string, error) {
|
||||
upperDir := filepath.Join(containerDir, "upper")
|
||||
workDir := filepath.Join(containerDir, "work")
|
||||
if err := idtools.MkdirAllAs(upperDir, 0700, rootUID, rootGID); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay %s directory", upperDir)
|
||||
}
|
||||
if err := idtools.MkdirAllAs(workDir, 0700, rootUID, rootGID); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay %s directory", workDir)
|
||||
}
|
||||
mergeDir := filepath.Join(contentDir, "merge")
|
||||
mergeDir := filepath.Join(containerDir, "merge")
|
||||
if err := idtools.MkdirAllAs(mergeDir, 0700, rootUID, rootGID); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to create the overlay %s directory", mergeDir)
|
||||
}
|
||||
|
||||
return contentDir, nil
|
||||
return containerDir, nil
|
||||
}
|
||||
|
||||
// Mount creates a subdir of the contentDir based on the source directory
|
||||
|
||||
Reference in New Issue
Block a user