(Splitting this off as well.) DJ Lucas wrote: > On 09/05/2011 07:48 PM, Bruce Dubbs wrote: >> DJ Lucas wrote: >>> There is no reason to redefine 35+ values every time a new script >>> is run. Once per runlevel change in rc is sufficient. One >>> conditional around the source line in each script, on a known >>> constant should be good, and will be more efficient, and >>> nominally faster than sourcing 2 or 3 files for every script that >>> is run. >> >> I don't really follow this. Do you mean sourcing the functions >> within the rc file? If so, environment variables have to be >> exported to be available in child scripts. Additionally the >> scripts need to have the variables available if not run from the rc >> file. >> >> If I misunderstand you, please elaborate. > > No, you didn't misunderstand. The variables have to be exported. > That's why there used to be a testcase around the source of distro > functions in /lib/lsb/init_functions. It was taken out with some of > the more recent changes (merger of $distro-functions and > /lib/lsb/init_functions) and I had forgotten to put it back. The > getty does not pass the variables to the login shell when rc passes > control.
getty is not involved here? Or at least, I don't see how it would be. This is before the non-"wait" lines in /etc/inittab get run (which run getty). rc doesn't run getty itself, either; it's run directly by init (as long as init is running as PID 1 and interpreting inittab itself). But apart from that -- Are the variables in question things like $HOSTNAME, or $UTC, or arguments to be given to dhcpcd? (Stuff that's set in an existing sysconfig file.) Or are the variables in question things like $ECHO or $RELOADSIG (which are set directly in the functions file)? If the former, then I think it makes far more sense to load them from the scripts that need them. (Especially since the scripts can be run by humans, from a logged in session after rc and all its children have exited, and not only by rc. Or by udev, which has no environment to speak of at all; I'm thinking of setclock here.) If the latter, then AFAIK they're not required outside the functions script anyway? (I don't think they're part of the LSB contract, though I could be wrong there.) Or are the variables in question here something else entirely? I don't think there is anything, but don't know for sure...
signature.asc
Description: OpenPGP digital signature
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page