xiwrap

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

commit
330c06e65834c95e5d749d051742a01985a0f739
parent
68552383789b1b7c78a0bfa0af3d0ca154dd7a85
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-08-15 05:23
mount /.flatpak-info read-only

Diffstat

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

1 files changed, 5 insertions, 4 deletions


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

@@ -24,7 +24,8 @@ The following options are available:
   24    24                         Bind mount the host path SRC on DEST. If SRC is not
   25    25                         provided, it is the same as DEST. See `man bwrap` for
   26    26                         details.
   27    -1 --bind-text TEXT DEST   Copy TEXT to a file which is bind-mounted on DEST.
   -1    27 --ro-bind-text TEXT DEST
   -1    28                         Copy TEXT to a file which is bind-mounted on DEST.
   28    29 --proc DEST             Mount new procfs on DEST.
   29    30 --dev DEST              Mount new dev on DEST.
   30    31 --tmpfs DEST            Mount new tmpfs on DEST.
@@ -177,7 +178,7 @@ class RuleSet:
  177   178                 raise RuleError(key, args)
  178   179             self.app_id = args[0]
  179   180             info = f'[Application]\nname={self.app_id}\n'
  180    -1             self.push_rule('bind-text', info, '/.flatpak-info')
   -1   181             self.push_rule('ro-bind-text', info, '/.flatpak-info')
  181   182         elif key in ['share-ipc', 'share-pid', 'share-net']:
  182   183             if len(args) != 0:
  183   184                 raise RuleError(key, args)
@@ -213,7 +214,7 @@ class RuleSet:
  213   214         ]:
  214   215             src, target = self.parse_path(key, args)
  215   216             self.paths[target] = (key, src)
  216    -1         elif key == 'bind-text':
   -1   217         elif key == 'ro-bind-text':
  217   218             if len(args) != 2:
  218   219                 raise RuleError(key, args)
  219   220             text, target = args
@@ -221,7 +222,7 @@ class RuleSet:
  221   222             os.write(w, text.encode())
  222   223             os.close(w)
  223   224             self.fds.append(r)
  224    -1             self.paths[target] = ('bind-data', str(r))
   -1   225             self.paths[target] = ('ro-bind-data', str(r))
  225   226         elif key in ['tmpfs', 'dev', 'proc', 'mqueue', 'dir']:
  226   227             if len(args) != 1:
  227   228                 raise RuleError(key, args)