summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2020-07-16 21:49:47 -0400
committerAshley Cui <acui@redhat.com>2020-07-21 14:22:30 -0400
commitd4d3fbc155419f4017064a65e718ad78d50115cc (patch)
tree4f73ccfa606a6f8a0d4de07749ce2323687b870d /libpod/options.go
parentdf6920aa79073b2767d24c6524367384b6284b31 (diff)
downloadpodman-d4d3fbc155419f4017064a65e718ad78d50115cc.tar.gz
podman-d4d3fbc155419f4017064a65e718ad78d50115cc.tar.bz2
podman-d4d3fbc155419f4017064a65e718ad78d50115cc.zip
Add --umask flag for create, run
--umask sets the umask inside the container Defaults to 0022 Co-authored-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go14
1 files changed, 14 insertions, 0 deletions
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.