Redhat

Jack Detrick vze24938 at verizon.net
Sun Jan 14 18:42:14 PST 2001


You can do error-checking in a script.  I have 4 separate scripts that
run (at last count) to install my LFS system all the way up to the
kernel "make menuconfig" and the reboot, and in each and every one of
those I have error checking every step of the way.  Even if something so
small as a file or two being copied for /mnt/lfs/bin to /mnt/lfs/usr/bin
or whatever screws up, the install stops and tells me.  It's all about
exit codes.  Here's my simple error-checking function:

check_status()
{
	if [ $? != 0 ]
	then
		echo "Oh no, I crashed!"
		echo "It happened while I was $CRASH!"
	fi
}

Then before each command, define CRASH to something specific for that
command.  Like with a Bash installation, before the "make" I would put:

CRASH="compiling Bash"

and after the "make" command, put:

check_status

If the "make" failed, I would get

Oh no, I crashed!
It happened while I was compiling Bash!

See?  It's a lot of typing for a set of install scripts where you're
installing so many packages, but if you want to cover all your bases and
know exactly where any problems occur, it's worth it.  Then again, I
type over 100wpm :0P
Currently I'm looking into using Perl or even C to do the install with,
but I know only some C and almost no Perl, and I have no idea how you
would use either language to pass commands to linux and do other such
stuff.  Anybody have any tips for somebody just getting into that?

Steve Hayashi wrote:
> 
> Actually, I'm not.  I only started writing scripts to do it for me a
> couple days ago.  The reason for the slow change was that if I had a
> script to do my compiling for me, and there was a compile error, I'd never
> know that I would have one until it was too late (that happened to me with
> glibc.  I didn't realize there was an error until I tried dynamically
> compiling bash).
> 
> I suppose getting a copy of the basic startup scripts would be pretty
> handy.
> 
> My latest problem with sysklogd, I have no idea where it came from.  I'm
> doing a full reinstall now and see if it goes away (I've been using Win98
> WAY too much, I know).
> 
> But still, it can take upwards of 2-3 hours to do a normal install of LFS,
> and that's not counting the initial distro installation.  That's probably
> why it's not a feasible enterprise OS.
> 
> -Steve
-- 
With no walls or fences on the internet, who needs Windows or Gates?

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




More information about the lfs-dev mailing list