123456789101112131415161718192021222324252627282930313233343536373839 |
- #!/usr/bin/env python3
- import os
- import pathlib
- import random
- import subprocess
- def _main():
- image_id = subprocess.run(
- [
- "podman",
- "build",
- pathlib.Path(__file__).parent,
- "--iidfile",
- "/dev/stdout",
- ],
- text=True,
- stdout=subprocess.PIPE,
- check=True,
- ).stdout.rsplit("\n", maxsplit=1)[1]
- assert image_id.startswith("sha256:"), image_id
- display_name = ":" + str(random.randint(1, 2**31 - 1))
- subprocess.Popen(["Xephyr", display_name, "-resizeable"])
- os.execvpe(
- "podman",
- [
- "podman",
- "container",
- "runlabel",
- "podman-run-x11",
- image_id,
- ],
- os.environ | {"DISPLAY": display_name},
- )
- if __name__ == "__main__":
- _main()
|