[BusyBox] startup scripts, environment, and ash
jfbauer at nfr.com
Fri Feb 18 08:37:04 MST 2005
On Thursday 17 February 2005 20:47, Finlay, Brion (STP) wrote:
> I have a startup script (/etc/init.d/rcS) that goes something like this:
> /etc/profile contains various parameters like PATH, LD_LIBRARY_PATH, etc.
> When startup is complete, and the interactive user shell is running, all
> of the variables set in /etc/profile are in the environment, the "test0"
> variable is not in the environment, and most (but not all, and only portions
> of some) of the variables put into "env-update" are in the environment.
> I have read some posts in the archives about how init forks a seperate
> shell and the variables in rcS shouldn't be in the environment of later
> shells. If that is true, then why do the variables in my /etc/profile
> get loaded, and the same with most (but oddly, not all, and only portions
> of some) of the variables in my "env-update" file?
Environment variables set in a shell script will not have any effect to
any parent process. init runs your rcS but init will never get the ENVs
set in rcS. Now if your init process was a shell and it sourced rcS, that
would be different.
You interactive shell most likely sourced /etc/profile on its own before
issuing the prompt. The kernel will make some of the boot args environment
variables for init. I believe all the ones with a '=' in them.
If you really want init and all its children have a bunch of environment
variables set try something like this
boot with: linux init=/sbin/init.sh
where /sbin/init.sh contains
More information about the busybox