1 |
> The init script will not see those variables when it is run by /sbin/rc |
2 |
> which is in turn run by init which is what happens on boot. The |
3 |
> environment is empty then, and if you want to reproduce it accurately |
4 |
> for your tests, you should do: |
5 |
> |
6 |
> env -i /etc/init.d/test restart |
7 |
> |
8 |
> It does see variables in /etc/rc.conf though: |
9 |
> |
10 |
> lion ~ # echo LANGTEST=testme >> /etc/rc.conf |
11 |
> lion ~ # env -i /etc/init.d/test restart |
12 |
> * Caching service dependencies ... [ ok ] |
13 |
> LANGTEST=testme |
14 |
> set | grep LANG |
15 |
|
16 |
And the init-script will also see the variables from /etc/conf.d/test |
17 |
|
18 |
But i cannot says, that i like the design. |
19 |
Should init.d-scripts see the env-variables from the current |
20 |
environment? I don't think so - even if it's usually root's environment. |
21 |
|
22 |
/sbin/rc could clear the environment and source /etc/profile.env |
23 |
instead. That would be pretty clever i think. An init-script would |
24 |
always run within the same environment no matter whether it's run by |
25 |
init or root's shell. |
26 |
|
27 |
How about that? |