From: Michael Tremer Date: Fri, 24 May 2013 15:35:46 +0000 (+0200) Subject: BIO: Update method how this is working and update to iPXE. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e847f85c1038a5f175e5e755efd3661c1bb6add4;p=ipfire.org.git BIO: Update method how this is working and update to iPXE. --- diff --git a/static/netboot/custom.gpxe b/static/netboot/custom.gpxe deleted file mode 100644 index e06369a5..00000000 --- a/static/netboot/custom.gpxe +++ /dev/null @@ -1,4 +0,0 @@ -#!gpxe -input id "Enter configuration ID to boot (eg, 1000)" -imgfree -chain http://boot.ipfire.org/config/${id}/boot.gpxe diff --git a/static/netboot/menu.c32 b/static/netboot/menu.c32 index ffea9cca..348c6b87 100644 Binary files a/static/netboot/menu.c32 and b/static/netboot/menu.c32 differ diff --git a/static/netboot/premenu.cfg b/static/netboot/premenu.cfg index 21049266..5068e617 100644 --- a/static/netboot/premenu.cfg +++ b/static/netboot/premenu.cfg @@ -1,3 +1,5 @@ +UI menu.c32 + menu color title * #FFFFFFFF * menu color sel * #ffffffff #999999ff * menu color hotsel 1;7;37;40 #ffffffff #999999ff * @@ -31,16 +33,3 @@ label text endtext kernel menu.c32 append menu.cfg - -menu separator - -label chain - menu label Boot a configuration directly... - text help - Select this option and enter a configuration ID to boot it directly. - endtext - kernel custom.gpxe - -label exit - menu label Quit to gPXE command line - menu quit diff --git a/static/netboot/pxelinux.0 b/static/netboot/pxelinux.0 new file mode 100644 index 00000000..528ad2c8 Binary files /dev/null and b/static/netboot/pxelinux.0 differ diff --git a/static/netboot/vesamenu.c32 b/static/netboot/vesamenu.c32 index f3480947..c466582b 100755 Binary files a/static/netboot/vesamenu.c32 and b/static/netboot/vesamenu.c32 differ diff --git a/webapp/__init__.py b/webapp/__init__.py index 10b1cf1d..c613ac86 100644 --- a/webapp/__init__.py +++ b/webapp/__init__.py @@ -184,7 +184,7 @@ class Application(tornado.web.Application): (r"/config/([0-9]+)/boot.gpxe", BootGPXEHandler), # Static files - (r"/(boot.png|custom.gpxe|premenu.cfg|vesamenu.c32|menu.c32)", + (r"/(boot\.png|premenu\.cfg|pxelinux\.0|menu\.c32|vesamenu\.c32)", tornado.web.StaticFileHandler, { "path" : BOOT_STATIC_PATH }), ]) diff --git a/webapp/handlers_boot.py b/webapp/handlers_boot.py index 29838936..93e8d18e 100644 --- a/webapp/handlers_boot.py +++ b/webapp/handlers_boot.py @@ -36,12 +36,41 @@ class MenuGPXEHandler(BootBaseHandler): menu.gpxe """ def get(self): - # XXX Check if version of the bootloader is allright + # Check if version of the bootloader is recent enough. + # Otherwise send the latest version of the PXE loader. + user_agent = self.request.headers.get("User-Agent", None) + if user_agent: + try: + client, version = user_agent.split("/") + except: + pass + else: + # We replaced gPXE by iPXE. + if client == "gPXE": + return self.serve_update() + + # Everything under version 1.0.0 should be + # updated. + if version < "1.0.0": + return self.serve_update() # Devliver content self.set_header("Content-Type", "text/plain") self.write("#!gpxe\n") - self.write("chain menu.c32 premenu.cfg\n") + + self.write("set 209:string premenu.cfg\n") + self.write("set 210:string http://boot.ipfire.org/\n") + self.write("chain pxelinux.0\n") + + def serve_update(self): + self.set_header("Content-Type", "text/plain") + self.write("#!gpxe\n") + + # Small warning + self.write("echo\necho Your copy of gPXE/iPXE is too old. ") + self.write("Upgrade to avoid seeing this every boot!\n") + + self.write("chain http://mirror0.ipfire.org/releases/ipfire-boot/latest/ipxe.kpxe\n") class MenuCfgHandler(BootBaseHandler):