xiwrap

slightly higher-level container setup utility
git clone https://git.ce9e.org/xiwrap.git

commit
7d3e5a9bd763f4c487b3cbdb8439b5dfa5d0fe44
parent
3d2a7a6dd65889e6d539a4f802218a8fefedc57a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-08-04 12:37
add --bind-text

Diffstat

M xiwrap.py 9 +++++++++

1 files changed, 9 insertions, 0 deletions


diff --git a/xiwrap.py b/xiwrap.py

@@ -23,6 +23,7 @@ The following options are available:
   23    23                         Bind mount the host path SRC on DEST. If SRC is not
   24    24                         provided, it is the same as DEST. See `man bwrap` for
   25    25                         details.
   -1    26 --bind-text TEXT DEST   Copy TEXT to a file which is bind-mounted on DEST.
   26    27 --proc DEST             Mount new procfs on DEST.
   27    28 --dev DEST              Mount new dev on DEST.
   28    29 --tmpfs DEST            Mount new tmpfs on DEST.
@@ -192,6 +193,14 @@ class RuleSet:
  192   193         ]:
  193   194             src, target = self.parse_path(key, args)
  194   195             self.paths[target] = (key, src)
   -1   196         elif key == 'bind-text':
   -1   197             if len(args) != 2:
   -1   198                 raise RuleError(key, args)
   -1   199             text, target = args
   -1   200             r, w = os.pipe2(0)
   -1   201             os.write(w, text.encode())
   -1   202             os.close(w)
   -1   203             self.paths[target] = ('bind-data', str(r))
  195   204         elif key in ['tmpfs', 'dev', 'proc', 'mqueue', 'dir']:
  196   205             if len(args) != 1:
  197   206                 raise RuleError(key, args)