User:Asc: Difference between revisions

From FAIWiki
Jump to navigation Jump to search
No edit summary
(clean uo)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
Installing with PXE and FAI MAC Address based.
Hello,


If you press <shift> key during pxe booting you can get a prompt.  
I am Andreas.
-----


Possible commands are:
These are some ideas, if you think they need a other location feel
mkboot HOST=local 
free to move. But leave a short message that I can remove it from this page.  
mkboot HOST=remove  
.....
mkboot HOST=demohost
.....


== Hook mkboot ==
------
 
<pre>
#! /bin/bash
# hook mkboot for fai.
# If you start this script on a fai client it copy, create or delete a pxe bootfile. It use the ethernet mac
# address of the fai client.
 
cd /tmp
TFTPCONFDIR="/boot/fai/pxelinux.cfg"
SSHUSER=fai
TFTPSERVER=faiserver
# TFTPSERVER=nsc
# TFTPCONFDIR="/var/lib/tftpboot/pxelinux.cfg"
# SSHUSER=cardtest
 
HOSTNAME="default"
if [ "$HOST" != "" ]; then HOSTNAME=$HOST; fi ;
BOOTMAC=`/sbin/ifconfig "$netdevices_up" |grep HWaddr|cut -d " " -f11|tr ':' '-'|tr '[:upper:]' '[:lower:]'`
BOOTMAC="01-"$BOOTMAC
echo Next Boot will boot or install: $HOSTNAME on $BOOTMAC.
echo "!!! OK - Press ctrl-c to interrupt FAI and to get a shell"
 
case $HOSTNAME in
    disable)
        ssh $SSHUSER@$TFTPSERVER "mv $TFTPCONFDIR/$BOOTMAC $TFTPCONFDIR/$BOOTMAC\.disable" ;;
    local)
        ssh $SSHUSER@$TFTPSERVER "mv $TFTPCONFDIR/$BOOTMAC $TFTPCONFDIR/$BOOTMAC\.disable ; cp $TFTPCONFDIR/local $TFTPCONFDIR/$BOOTMAC " ;;
    enable)
        ssh $SSHUSER@$TFTPSERVER "mv $TFTPCONFDIR/$BOOTMAC\.disable $TFTPCONFDIR/$BOOTMAC" ;;
    remove)
        ssh $SSHUSER@$TFTPSERVER "rm $TFTPCONFDIR/$BOOTMAC" ;;
    *)
        ssh $SSHUSER@$TFTPSERVER "cp $TFTPCONFDIR/$HOSTNAME $TFTPCONFDIR/$BOOTMAC" ;;
esac
 
task_faiend
 
# End of mkboot
</pre>
 
== Hook chboot.default ==
 
<pre>
#! /bin/sh
# 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=faiserver
# TFTPCONFDIR="/var/lib/tftpboot/pxelinux.cfg"
# SSHUSER=cardtest
# TFTPSERVER=nsc
HOSTNAME="local"
 
BOOTMAC=`/sbin/ifconfig "$netdevices_up" |grep HWaddr|cut -d " " -f11|tr ':' '-'|tr '[:upper:]' '[:lower:]'`
BOOTMAC="01-"$BOOTMAC
echo Next Boot will boot or install: $HOSTNAME on $BOOTMAC.
 
case $HOSTNAME in
    local)
        ssh $SSHUSER@$TFTPSERVER "mv $TFTPCONFDIR/$BOOTMAC $TFTPCONFDIR/$BOOTMAC\.disable ; cp $TFTPCONFDIR/local $TFTPCONFDIR/$BOOTMAC " ;;
    *)
        ssh $SSHUSER@$TFTPSERVER "cp $TFTPCONFDIR/$HOSTNAME $TFTPCONFDIR/$BOOTMAC" ;;
esac
 
skiptask $skiptask
 
# End of hook chboot.DEFAULT
</pre>
 
== File: /boot/fai/pxelinux.cfg/default ==
<pre>
default install
 
label install
kernel vmlinuz-install
append ip=dhcp devfs=nomount FAI_ACTION=mkboot HOST=demohost root=/dev/nfs nfsroot=/usr/lib/fai/nfsroot,v2,rsize=32768,wsize=32768  FAI_FLAGS=verbose,sshd,createvt,reboot
 
label mkboot
kernel vmlinuz-install
append ip=dhcp devfs=nomount FAI_ACTION=mkboot root=/dev/nfs nfsroot=/usr/lib/fai/nfsroot,v2,rsize=32768,wsize=32768  FAI_FLAGS=verbose,sshd,createvt,reboot
</pre>
 
== File: /boot/fai/pxelinux.cfg/local ==
<pre>
default local
 
label local
localboot 0
 
label mkboot
kernel vmlinuz-install
append ip=dhcp devfs=nomount FAI_ACTION=mkboot root=/dev/nfs nfsroot=/usr/lib/fai/nfsroot,v2,rsize=32768,wsize=32768  FAI_FLAGS=verbose,sshd,createvt,reboot
</pre>
 
== File: /boot/fai/pxelinux.cfg/demohost ==
<pre>
default demohost
 
label demohost
kernel vmlinuz-install
append ip=dhcp devfs=nomount FAI_ACTION=install HOST=demohost root=/dev/nfs nfsroot=/usr/lib/fai/nfsroot,v2,rsize=32768,wsize=32768  FAI_FLAGS=verbose,sshd,createvt
</pre>

Latest revision as of 06:15, 26 October 2016

Hello,

I am Andreas.


These are some ideas, if you think they need a other location feel free to move. But leave a short message that I can remove it from this page.