diff --git a/subiquity/controllers/cmdlist.py b/subiquity/controllers/cmdlist.py index 50621d46..d00eb940 100644 --- a/subiquity/controllers/cmdlist.py +++ b/subiquity/controllers/cmdlist.py @@ -13,6 +13,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import os + from subiquitycore.context import with_context from subiquitycore.utils import arun_command @@ -35,14 +37,18 @@ class CmdListController(NoUIController): def load_autoinstall_data(self, data): self.cmds = data + def env(self): + return os.environ.copy() + @with_context() async def run(self, context): + env = self.env() for i, cmd in enumerate(self.cmds): with context.child("command_{}".format(i), cmd): if isinstance(cmd, str): cmd = ['sh', '-c', cmd] await arun_command( - cmd, + cmd, env=env, stdin=None, stdout=None, stderr=None, check=self.cmd_check) @@ -56,6 +62,11 @@ class LateController(CmdListController): autoinstall_key = 'late-commands' + def env(self): + env = super().env() + env['TARGET_MOUNT_POINT'] = self.app.base_model.target + return env + @with_context() async def apply_autoinstall_config(self, context): await self.run(context=context)