From c825c7e4fad80d10f620d982a1188251d89dca2c Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 8 Dec 2021 11:12:55 +0000 Subject: [PATCH] buildroot: set container env variable Set the container environment variable to indicate to programs inside the build root that they are indeed running inside a container (see also https://systemd.io/CONTAINER_INTERFACE/). --- osbuild/buildroot.py | 1 + test/mod/test_buildroot.py | 1 + 2 files changed, 2 insertions(+) diff --git a/osbuild/buildroot.py b/osbuild/buildroot.py index b7940754..317f73aa 100644 --- a/osbuild/buildroot.py +++ b/osbuild/buildroot.py @@ -275,6 +275,7 @@ class BuildRoot(contextlib.AbstractContextManager): # Setup a new environment for the container. env = { + "container": "bwrap-osbuild", "LC_CTYPE": "C.UTF-8", "PATH": "/usr/sbin:/usr/bin", "PYTHONPATH": "/run/osbuild/lib", diff --git a/test/mod/test_buildroot.py b/test/mod/test_buildroot.py index 23f17ff3..849c24be 100644 --- a/test/mod/test_buildroot.py +++ b/test/mod/test_buildroot.py @@ -214,6 +214,7 @@ def test_env_isolation(tempdir): allowed = [ "_", # added by `env` itself + "container", "LC_CTYPE", "PATH", "PWD",