jkm wrote: > Dear Paul > > > I'm curious whether you can solve your problem by simply setting > > TERM and HOME in /etc/profile. It looks to me like it should be > > read, given that you've started ash with "-/bin/ash" in inittab. > > Of course, I have already done that, but I consider it > as a temporary workaround rather than a real solution.
Ah, okay. It feels "real" to me -- at least as "real" as spawning user shells directly from init. Why would the boot loader ever be involved in determining a home directory, or a terminal type? The boot loader's job is to run the correct kernel for the hardware -- not establish the userspace environment. Traditionally HOME is set by login, and TERM is set either by the user, or sometimes via getty. If you don't want a login prompt (understandable) then you're probably looking for something like agetty's --autologin flag, which allows you to suppress the prompting, while still using all of the usual login mechanisms. (I'm a little surprised busybox's getty doesn't already have that. > > > I haven't thought all that hard about this, but from looking at > > the code, and your requirements (which are surprising to me, but > > maybe shouldn't be), perhaps the best busybox change would be > > a new FEATURE_INIT_INHERIT_ENVIRONMENT, which prevents init from > > setting any environment at all. I assume your boot code > > could set PATH and SHELL as well as TERM and HOME? > HOME and TERM environment variables are crucial for other programs > that init command is supposed to spawn. In my humble opinion, > user should be able to pass these env vars along with boot params > and expect init command to respect them. My proposal is to at least My proposal would allow that too. And it would avoid having to add "if (!alreadyset)" checks for the other variables init sets up, when someone else asks. But clearly, your proposal would work as well. As does setting the variables in /etc/profile. ;-) paul > add a check if HOME env var is set and only if HOME env var is not > passed, then set it to "/": > > /* Make sure environs is set to something sane */ > - putenv((char *) "HOME=/"); > + if (getenv("HOME") == NULL) > + putenv((char *) "HOME=/"); > + > putenv((char *) bb_PATH_root_path); > > What do you think? > > Regards, > jkm > _______________________________________________ > busybox mailing list > busybox@busybox.net > http://lists.busybox.net/mailman/listinfo/busybox > =---------------------- paul fox, p...@foxharp.boston.ma.us (arlington, ma) _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox