From: Michael Tremer Date: Wed, 11 Oct 2017 19:43:37 +0000 (+0200) Subject: netboot: Make version detection easier by adding our own version field X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d71ac64d3845a6b7e29944dda810a7a342685a6;p=ipfire.org.git netboot: Make version detection easier by adding our own version field Signed-off-by: Michael Tremer --- diff --git a/static/netboot/ipxe.kpxe b/static/netboot/ipxe.kpxe index 75cd559a..8096b724 100644 Binary files a/static/netboot/ipxe.kpxe and b/static/netboot/ipxe.kpxe differ diff --git a/webapp/handlers_boot.py b/webapp/handlers_boot.py index bea3acef..0fc23c03 100644 --- a/webapp/handlers_boot.py +++ b/webapp/handlers_boot.py @@ -14,6 +14,8 @@ from handlers_base import BaseHandler BASEDIR = os.path.dirname(__file__) +LATEST_VERSION = "2.0" + def word_wrap(s, width=45): paragraphs = s.split('\n') lines = [] @@ -49,32 +51,14 @@ class BootBaseHandler(BaseHandler): class MenuGPXEHandler(BootBaseHandler): + """ menu.gpxe """ def get(self): - # 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" or version == "1.0.0+": - return self.serve_update() - - # This is an outdated git build - for v in ("c4bce", "300a371"): - if v in version: - return self.serve_update() + version = self.get_argument("version", None) + if not version or version < LATEST_VERSION: + return self.serve_update() # Deliver content self.set_header("Content-Type", "text/plain")