From 865d77e942b8cb68508aec3d085387f4a23a8557 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Mon, 12 Jun 2023 14:26:09 +0100 Subject: [PATCH] pkg/specgen: add support for 'podman run --init' on FreeBSD This adds define.BindOptions to declare the mount options for bind-like mounts (nullfs on FreeBSD). Note: this mirrors identical declarations in buildah and it may be preferable to use buildah's copies throughout podman. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson --- libpod/define/mount_freebsd.go | 5 +++++ libpod/define/mount_linux.go | 5 +++++ pkg/specgen/generate/storage.go | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libpod/define/mount_freebsd.go b/libpod/define/mount_freebsd.go index e080c9ec6c..3150ffbe7a 100644 --- a/libpod/define/mount_freebsd.go +++ b/libpod/define/mount_freebsd.go @@ -6,3 +6,8 @@ const ( // TypeBind is the type for mounting host dir TypeBind = "nullfs" ) + +var ( + // Mount potions for bind + BindOptions = []string{} +) diff --git a/libpod/define/mount_linux.go b/libpod/define/mount_linux.go index 5ef8489052..126e0d6c77 100644 --- a/libpod/define/mount_linux.go +++ b/libpod/define/mount_linux.go @@ -6,3 +6,8 @@ const ( // TypeBind is the type for mounting host dir TypeBind = "bind" ) + +var ( + // Mount potions for bind + BindOptions = []string{"bind"} +) diff --git a/pkg/specgen/generate/storage.go b/pkg/specgen/generate/storage.go index ffaaa0e1fb..52d7427520 100644 --- a/pkg/specgen/generate/storage.go +++ b/pkg/specgen/generate/storage.go @@ -363,7 +363,7 @@ func addContainerInitBinary(s *specgen.SpecGenerator, path string) (spec.Mount, Destination: define.ContainerInitPath, Type: define.TypeBind, Source: path, - Options: []string{define.TypeBind, "ro"}, + Options: append(define.BindOptions, "ro"), } if path == "" {