From ba76e2919b6791c78d2c1e79cb50dbc4731a5b00 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Mon, 30 Sep 2024 00:23:57 +0900 Subject: bwrap: implement argument builder Signed-off-by: Ophestra Umiker --- bwrap/config.string.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 bwrap/config.string.go (limited to 'bwrap/config.string.go') diff --git a/bwrap/config.string.go b/bwrap/config.string.go new file mode 100644 index 00000000..c5c7a41e --- /dev/null +++ b/bwrap/config.string.go @@ -0,0 +1,35 @@ +package bwrap + +const ( + Hostname = iota + Chdir + UnsetEnv + LockFile + RemountRO + + stringC +) + +var stringArgs = func() (n [stringC]string) { + n[Hostname] = "--hostname" + n[Chdir] = "--chdir" + n[UnsetEnv] = "--unsetenv" + n[LockFile] = "--lock-file" + n[RemountRO] = "--remount-ro" + + return +}() + +func (c *Config) stringArgs() (n [stringC][]string) { + if c.Hostname != "" { + n[Hostname] = []string{c.Hostname} + } + if c.Chdir != "" { + n[Chdir] = []string{c.Chdir} + } + n[UnsetEnv] = c.UnsetEnv + n[LockFile] = c.LockFile + n[RemountRO] = c.RemountRO + + return +} -- cgit v1.3.1