Another LFS Newbie writting bash alfs scripts

Grant Leslie grantl at nbnet.nb.ca
Thu Oct 17 00:53:55 PDT 2002


> 1) why do you do "find / >lfs-files/all-files"? won't that include all
> of your /static libraries and binaries?

Yeh it does.. that was quick and dirty...
changed it to
find /boot /dev /etc ... and so on after posting..
and at the start of the build, I just
touch lfs-files/all-files
instead now.

> 2)"for package_name in `cat lfs-packages-list`" I see "lfs-package.list,
> is that a typo?

yeh it was :-/ sorry

>
> 3)what does the "tee" command do?

it allows you to redirect standard output to a file, while still echoing it
to the console. I leave the build happening on the console of my linux box,
so I wanted a way to check where it was quickly, by ssh'ing into, without
walking over to it.

>
> 4)where do you set the $1.sh variable?

when the main build script calls the lfs-make script it calls it with the
package name ie.
lfs-make bash
the $1 variable is set by the shell when it calls the new script, simply
means the first listed option, parameter, which ever ya wanna call it

>
> 5) "exec /usr/src/lfs/lfs-commands/$1.sh || exit 1" this looks really
> nice, I'm guessing this starts a new shell, builds the package, then
> exits?  I am just curious about when you loging to bash in ch.6 again...
> if you exit, aren't you not logged in any more?

the exit only gets executed if the the exec fails.. ie.. the script named
doesn't exist, I did this so any errors would propogate up, causing the
whole build to stop on any errors, instead of just sending an error message
to stderr, and continuing on, having missed a vital step, making a nasty
mess
( I didn't get the error checking finished in the chapter 6 parts )
it doesn't log you out, only exits the currently running copy of the shell,
ie.. the one running that script

> script, it's very very basic, but it does the job so far.... (I haven't
> worked on it for a while, so i haven't really fixed that login thing yet)

Don't suppose you could initially run the script as root, ie.. at first to
create /mnt/lfs/static and chown it.. and then
su lfs -c script-to-compile-and-install-chapter-5-packages
to change to the lfs user and execute the script..
linux won't be asking for a password going in this direction,
though I'd be paranoid enough to be putting something like

if [ $(whoami) != "lfs" ] ; then
	echo "ACK wrong user!!"
	exit 1
fi

at the start of each script, just to be sure ( and safer )

> well, I just wanted to share what i've done with somebody I guess.  I am
> going to try out your scrip when I get some time.  I want to create a
> bootable lfs cd eventually, with all of the packages on it, so that I
> can install lfs on computers w/out having another distro on it.

watch out for the end of those scripts... it really just compiles and
installs, the configuration is there yet, especially for the kernel.. since
as it sits it tries to start the kernel configuration, when the startard
output is redirected.. OPS :-/

>
> again, thanks very much if you can answer any of my questions.... your
> script looks very nice
>

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list