[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Passing extra environment variables to lb chroot_install



On 2020-03-28 09:20, jnqnfe@gmail.com wrote:
On Fri, 2020-03-20 at 17:50 +0000, Witold Baryluk wrote:
I want all instances of apt in the chroot during lb build, to have
few extra
environment variables, for example:

export NEEDRESTART_SUSPEND=1
export APT_LISTCHANGES_FRONTEND=none

I am not sure how to do that, without modifying the lb itself.

Similarly, I might want to pass some environment variables to the
custom
hooks in the chroot. For the hooks, I could create custom file with
exports / variables and source it in the chroot hooks,
but it will not work for the lb chroot.

try placing them in config/environment or config/environment.chroot

each line of these files not starting with a '#' is included into the
ENV variable by the Chroot() function (functionc/chroot.sh) and
presumably is precisely intended for your use case.

I can confirm that adding 'VARNAME=value' to config/environment.chroot
successfully passes an environment variable to chroot hooks.

Also, to quote the live manual:
"chroot hooks have access to the build config/ directory, temporarily mounted on /live-build/config in the chroot"
so chroot hook scripts can refer to (or even modify?) anything in config/

--
John


Reply to: