From d4d3fbc155419f4017064a65e718ad78d50115cc Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Thu, 16 Jul 2020 21:49:47 -0400 Subject: Add --umask flag for create, run --umask sets the umask inside the container Defaults to 0022 Co-authored-by: Daniel J Walsh Signed-off-by: Ashley Cui --- libpod/options.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libpod/options.go') diff --git a/libpod/options.go b/libpod/options.go index 40cf452db..41b0d7212 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1607,6 +1607,20 @@ func WithTimezone(path string) CtrCreateOption { } } +// WithUmask sets the umask in the container +func WithUmask(umask string) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + if !define.UmaskRegex.MatchString(umask) { + return errors.Wrapf(define.ErrInvalidArg, "Invalid umask string %s", umask) + } + ctr.config.Umask = umask + return nil + } +} + // Pod Creation Options // WithPodName sets the name of the pod. -- cgit v1.2.3-54-g00ecf