image: add LUKS support and --[no-]encryption CLI flag to build & inspect subcommands

This commit is contained in:
InsanePrawn 2023-07-09 03:20:33 +02:00
parent 39b9cebc54
commit 6a7bfbb49b
5 changed files with 236 additions and 49 deletions

View file

@ -171,9 +171,9 @@ def symlink(source, target):
raise Exception(f'Symlink creation of {target} pointing at {source} failed')
def get_temp_dir(register_cleanup=True, mode: int = 0o0755):
def get_temp_dir(register_cleanup=True, mode: int = 0o0755, prefix='kupfertmp_'):
"create a new tempdir and sanitize ownership so root can access user files as god intended"
t = mkdtemp()
t = mkdtemp(prefix=prefix)
chmod(t, mode, privileged=False)
if register_cleanup:
atexit.register(remove_file, t, recursive=True)