How to prevent new installations when I have already installed my client through LAN boot?

Sylvain Milot sylvain at bic.mni.mcgill.ca
Mon Feb 6 15:06:52 CET 2012


On Sun, 5 Feb 2012, Ivan Reche wrote:

> I'm using FAI to automatically install Debian Squeeze in a laptop of mine.
> I've been able to do everything that I wanted by reading the documentation,
> except for one thing: every time the installation finishes (and the system
> reboots automatically, as I ask it to), the recently installed client boots
> again through the LAN (as expected) but begins the installation process
> again (something that I want to avoid).
>
> Is there an automatic way to make the client prevent itself from
> reinstalling after the first install? I want it to install itself again
> only if needed using the fai-chboot program, but not every time.
>
> Thanks in advance.
>
> Ivan
>


Hi,

this is done with a hook ...

http://fai-project.org/fai-guide/ar01s07.html#_anchor_id_hooks_xreflabel_hooks_hooks

the recipe can probably be found somewhere on fai-project.org but here's an example:

tutor:/export/home/fai/config# cat hooks/chboot.DEFAULT 
#! /bin/bash 
# hook for fai. Set boot to local 
set -xv

SCRIPTNAME=`basename $0`
skiptask=`echo $SCRIPTNAME | sed "s/\..*$//"`

cd /tmp 
TFTPCONFDIR="/boot/fai/pxelinux.cfg"
SSHUSER=fai
TFTPSERVER=$installserver

HOSTNAME="local"

BOOTIP=`ifconfig "$netdevices_up" | grep 'inet addr:' | sed "s/[^:]*://" | cut -d " " -f1 | sed "s/\./ /g"`
BOOTIP=`printf "%02X%02X%02X%02X\n" $BOOTIP`

echo Next Boot will boot or install: $HOSTNAME on $BOOTIP.

case $HOSTNAME in
      local)
          ssh -o StrictHostKeyChecking=no $SSHUSER@$TFTPSERVER "mv $TFTPCONFDIR/$BOOTIP $TFTPCONFDIR/$BOOTIP\.disable ; \cp $TFTPCONFDIR/local $TFTPCONFDIR/$BOOTIP " ;;
      *)
           ssh $SSHUSER@$TFTPSERVER "\cp $TFTPCONFDIR/$HOSTNAME $TFTPCONFDIR/$BOOTIP" ;;
esac

skiptask $skiptask

# End of hook chboot.DEFAULT


---
Sylvain Milot (sylvain at bic.mni.mcgill.ca)
Brain Imaging Centre
Montreal Neurological Institute
3801 University Street
Webster 2B, Room 206
Montreal, Qc., Canada, H3A 2B4


More information about the linux-fai mailing list