diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/chroottar.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/chroottar.py b/examples/chroottar.py index 3c38a97..42c09ef 100755 --- a/examples/chroottar.py +++ b/examples/chroottar.py @@ -9,6 +9,7 @@ a user and mount namespace. import argparse import os import pathlib +import re import socket import sys import tempfile @@ -74,7 +75,8 @@ def main() -> None: os.setregid(0, 0) os.setgroups([]) for tmem in tarf: - if tmem.name.removeprefix("./").startswith("dev/"): + name = re.sub(r"^/*(\.{1,2}/+)*", "", tmem.name) + if name.startswith("dev/"): continue tarf.extract(tmem, numeric_owner=True) linuxnamespaces.bind_mount(".", "/mnt", recursive=True) |