29 lines
789 B
Python
29 lines
789 B
Python
import cStringIO
|
|
import time
|
|
|
|
from khepri import hook, get_mac
|
|
|
|
@hook(r"^pxelinux.cfg/default$")
|
|
def pxelinux_default(path, match, remote):
|
|
(raddress, rport) = remote
|
|
mac = get_mac(raddress)
|
|
if not mac:
|
|
s = "localboot 0"
|
|
else:
|
|
s = """ default menu.c32
|
|
prompt 0
|
|
|
|
menu title "Khepri Boot Menu generated at %s for %s:%i"
|
|
menu INCLUDE pxelinux.cfg/graphics.conf
|
|
MENU AUTOBOOT Starting Xen Node in # seconds
|
|
|
|
label xen
|
|
menu label ^Xen Node
|
|
menu default
|
|
timeout 80
|
|
kernel xen/vmlinuz
|
|
append rootfstype=nfs root=/dev/nfs nfsroot=10.8.1.1:/var/khepri/nfs/xen,v4,rsize=16384,wsize=16384 ip=:::::eth0:dhcp
|
|
""" % (time.strftime("%d/%m/%Y at %H:%M:%S"), raddress, rport)
|
|
return cStringIO.StringIO(s)
|
|
|
|
|