#!/bin/bash
# on reception of a message "Kickstart install completed on 52:54:0a:00:00:02"
# creates a file to force boot on local disk for this node

# split the message in multiple arguments
set -- $1

# mac adress is the 5th
mac=$5


# create a boot pxe menu containing only disk boot
# file must be named 01-mac 
#    01 is for Ethernet (ARP type "1") 
#    mac is mac address with : replaced by -
# see: http://www.syslinux.org/wiki/index.php?title=PXELINUX
#
mac=${mac//:/-}
file=/var/lib/tftpboot/pxelinux/pxelinux.cfg/01-$mac
cat >>  $file <<EOF

DEFAULT menu.c32
PROMPT 0
TIMEOUT 10
MENU TITLE ENSIEE Menu

LABEL local
MENU LABEL Boot on local hard drive
LOCALBOOT 0

EOF
chmod 0644 $file
