Suggestions for change in setting up "lfs" user

Dan Nicholson dbn.lists at gmail.com
Thu Jan 31 09:44:45 PST 2008


On Jan 30, 2008 11:56 PM, Ag. D. Hatzimanikas <a.hatzim at gmail.com> wrote:
>
> On Wed, Jan 30, at 04:35 armencho at gmail.com wrote:
> > Chapter 4.3 - 4.4: Is there any particular crucial reason why the bash
> > startup scripts for lfs user have to be created and subsequently sourced
> > ("source ~/.bash_profile" instruction) by user after having logged in? It is
> > not a big deal with the book, but is a problem if the host has persistent
> > storage (hard disk) and/or the build is automated and allows interrupting,
> > in which there can be cases where the startup scripts will be sourced twice.
> > I am writing such an automation script for LFS and need to circumvent this
> > problem. I have looked into 'jhalfs' project but it has come to a point
> > where it is too complicated to really learn from what I need to know..
>
> What we really care is a clean/safe environment, so that we can be independent
> from the host system (using the new tools) as soon as possible.
>
> What I do and if I remember Jhalfs is doing something similar, is to run
> a command like:
>
> -------%>----------------
> su - $user -c "source ~/.bashrc&& cd $script_tools_dir && ./master"
> -------%>----------------
> where user=lfs and $script_tools_dir is the directory with the scripts.
>
> As you can see, after sourcing the ~/.bashrc (where I setup the environment),
> I then give control to a master script, which is then responsible to run the
> rest of the build in the chapter05 (and exit in errors!).

Right. The purpose of the book is to help people interactively, not to
be tailored to scripting. Just like everyone else, if you're scripting
the build, you have to figure out a different way to ensure the proper
environments. Ag's method is a perfectly acceptable way to manage
this. I personally don't create any environment for the temp user and
instead recreate the necessary environment in the script.

--
Dan



More information about the lfs-support mailing list