Proposed small change

Kjetil Torgrim Homme kjetilho at linpro.no
Mon Jul 30 21:36:45 CEST 2001


A colleague asked me if we could use FAI to do quick and easy
reinstallations from an image.  While I generally prefer FAI's method
of installing the core OS and do changes to it (I come from Jumpstart,
too), it's easy to add this capability.

I edited /sbin/rcS_fai like this:

    call_hook extrbase
    if ifclass MY_OWN_BASE
    then
        : ; # Do the work in the above hook
    else
        echo "Unpacking Debian base archive"
        zcat /var/tmp/base.tgz | tar -C $FAI_ROOT -xpf -
    fi
    call_hook mirror

and added a file called hooks/extrbase.IMG_FOO with the contents

=== cut here ===
#! /bin/sh

echo Unpacking tarball for FOO client in $target

cd $target
mkdir -p bin lib etc tmp
chmod 1777 tmp
cp -p /bin/tar bin/
cp -p /lib/libc.so* /lib/ld-* lib/

zcat /fai/images/foo.tar.gz | $ROOTCMD tar zxf -
=== and here ===

The tar file was created using

  tar zclf /someplace-with-room/foo.tar.gz --exclude=/tmp / /var /usr

on the client, and then copied to the FAI server.

I also had to define the classes MY_OWN_BASE and IMG_FOO for the
clients this rule should apply to, of course.

In general, it would be nice if a hook could make the code following
it be skipped.  Perhaps move most of the actual code from rcS_fai into
hooks/*.DEFAULT?  After all, you can still write hooks which look like

   #! /bin/sh
   ... my stuff
   # then the normal behaviour
   . /fai/hooks/baseextr.DEFAULT

You could even write a function called fai_default_action which
invokes the right *.DEFAULT hook.  The downside to this change is that
old hook files must be updated when people upgrade FAI.

This feature is only _needed_ if you want to use FAI to install
something other than Debian, like Red Hat.  But it would be nice
nonetheless, no?


Kjetil T.

PS. I had a look at Replicator.  FAI's design is _way_ superior, but
    it may need a little polish to compete with it, like scripts to do
    what I did above easily.



More information about the linux-fai mailing list