set env in chroot script

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Sat Apr 28 14:30:21 UTC 2007


Elan Marikit <emarikit at infoweapons.com> writes:

> I am a newbie of FreeBSD and I want to know how to set environment
> inside chroot in a shell script.
>
> My script looks like this:
> chroot $NEWROOT /bin/sh -c "<command>"
>
> And I want to set an environment, before the <command>.
>
> Is it possible that it will inherit my parent environment? like the
> environment set in my script?

According to the chroot(8) manual, only the SHELL value will
be inherited.

Try making a wrapper script to set the values you want, and
call the command from inside that script.


More information about the freebsd-questions mailing list