[gPXE] Pushing GPXE script to HTTP server

Lindgren Daniel daniel.lindgren at tullverket.se
Tue Nov 2 07:07:03 EDT 2010


from the ROM script, e g:
> 
> dhcp net0
> chainload http://urania/genconf.php?IP=${net0/ip}
> 
> And extend the CGI script to use the IP variable:
> 
> <?php
> header ( "Content-type: text/plain" );
> $ipaddr = $_GET['IP'];
> # ...
> # ... use the supplied IP address to figure out the closest 
> webserver and nfsroot, set $closest_web and $closest_nfs # ...
> echo "dhcp net0\n";
> echo "initrd http://$closest_web/initrd.gz\n"; echo "kernel 
> http://$closest_web/vmlinuz boot=casper toram netboot=nfs 
> nfsroot=$closest_nfs:/export/trubuntu -- boot\n"; ?>
> 
> See http://etherboot.org/wiki/commandline for more info.

I'll correct that myself, some missing lines, copy/paste errors and line
breaks messed up by mail client(?).

The embedded script:

#!gpxe 
dhcp net0 
chain http://urania/genconf.php?IP=${net0/ip} 

The CGI script (genconf.php):

<?php 
header ( "Content-type: text/plain" ); 
$ipaddr = $_GET['IP']; 
# ... 
# ... use the supplied IP address to figure out the closest webserver
and nfsroot, set $closest_web and $closest_nfs 
# ... 
echo "#!gpxe\n"; 
echo "dhcp net0\n"; 
echo "initrd http://$closest_web/initrd.gz\n"; 
echo "kernel http://$closest_web/vmlinuz boot=casper toram netboot=nfs
nfsroot=$closest_nfs:/export/trubuntu -- boot\n"; 
?> 

Mail client and/or mailing list software may massacre line breaks.

Cheers,
Daniel



More information about the gPXE mailing list