[syslinux] How to run server side script from boot menuselection ?
Shao Miller
Shao.Miller at yrdsb.edu.on.ca
Wed Jan 13 12:59:04 PST 2010
Moody Ahmad wrote:
> ...I would also appreciate any suggestions on what is a good way to do
> this server-side script...
Unfortunately, the best way that I know of to pass client-specific
params to a CGI script on a web-server from PXELINUX is not using
gpxelinux.0
Instead, you'd need the gPXE source code and the ability to compile it.
Then you'd go into your gpxe/src/ directory and do:
make EMBEDDED_IMAGE=~/param_boot.gpxe bin/undionly.kkpxe
where ~/param_boot.gpxe would be a gPXE script in your home directory.
Something like:
#!gpxe
dhcp net0
set 210:string
http://web-server/client?mac=${mac}&ip=${ip}&manu=${manufacturer:uristring}&model=${product:uristring}&serial=${serial:uristring}&asset=${smbios/3.8.0:uristring}&biosrev=${smbios/0.5.0:uristring}&file=
chain ${210:string}pxelinux.0
In this ugly-looking URI, your CGI script would be passed these details
every time the client downloads a file. Thus, you CGI script would have
to use the &file= parameter to determine which file to actually return.
The first such file it would need to return would be pxelinux.0 (not
gpxelinux.0), which you can see that the 'chain' command immediately
tries to request. After that, any files references by your PXELINUX
config-files whose paths are non-absolute (relative) would have this
DHCP option 210 prefixed to them. So if your config-file looked like this:
DEFAULT dos
LABEL dos
KERNEL memdisk
INITRD dos.vfd
then the client would try to download something like:
http://web-server/client?mac=00:FF:FF:FF:FF:FF&ip=192.168.0.104&manu=Dell&model=Optiplex%20GX260&serial=ABCDEFG&asset=ASSETABCD&biosrev=20A&file=memdisk
Pretty long! But at least the CGI script can make an informed decision
about what file to return to the client as "memdisk," for whatever
that's worth. Then next file download would be the same detail, except
&file=dos.vfd
- Shao Miller
More information about the Syslinux
mailing list