[arch-projects] [archweb] [RFCv2 2/2] releng: Add netboot pxelinux environment to archweb.

Thomas Bächler thomas at archlinux.org
Thu Jun 27 11:01:39 EDT 2013


---
 releng/templatetags/__init__.py          |   0
 releng/templatetags/host_from_url.py     |  10 +++
 releng/urls.py                           |  23 +++++-
 releng/views.py                          |  27 ++++++-
 sitestatic/netboot/pxe/hdt.c32           | Bin 0 -> 350680 bytes
 sitestatic/netboot/pxe/hdt/modalias.gz   | Bin 0 -> 79430 bytes
 sitestatic/netboot/pxe/hdt/pciids.gz     | Bin 0 -> 206454 bytes
 sitestatic/netboot/pxe/ifcpu64.c32       | Bin 0 -> 1312 bytes
 sitestatic/netboot/pxe/memtest.bin       | Bin 0 -> 164504 bytes
 sitestatic/netboot/pxe/menu.c32          | Bin 0 -> 55268 bytes
 sitestatic/netboot/pxe/pxelinux.0        | Bin 0 -> 26579 bytes
 sitestatic/netboot/pxe/reboot.c32        | Bin 0 -> 800 bytes
 sitestatic/netboot/pxe/splash.png        | Bin 0 -> 45400 bytes
 sitestatic/netboot/pxe/vesamenu.c32      | Bin 0 -> 153488 bytes
 templates/releng/pxelinux.cfg.txt        | 118 +++++++++++++++++++++++++++++++
 templates/releng/pxelinux_choose.cfg.txt |  13 ++++
 16 files changed, 188 insertions(+), 3 deletions(-)
 create mode 100644 releng/templatetags/__init__.py
 create mode 100644 releng/templatetags/host_from_url.py
 create mode 100644 sitestatic/netboot/pxe/hdt.c32
 create mode 100644 sitestatic/netboot/pxe/hdt/modalias.gz
 create mode 100644 sitestatic/netboot/pxe/hdt/pciids.gz
 create mode 100644 sitestatic/netboot/pxe/ifcpu64.c32
 create mode 100644 sitestatic/netboot/pxe/memtest.bin
 create mode 100644 sitestatic/netboot/pxe/menu.c32
 create mode 100644 sitestatic/netboot/pxe/pxelinux.0
 create mode 100644 sitestatic/netboot/pxe/reboot.c32
 create mode 100644 sitestatic/netboot/pxe/splash.png
 create mode 100644 sitestatic/netboot/pxe/vesamenu.c32
 create mode 100644 templates/releng/pxelinux.cfg.txt
 create mode 100644 templates/releng/pxelinux_choose.cfg.txt

diff --git a/releng/templatetags/__init__.py b/releng/templatetags/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/releng/templatetags/host_from_url.py b/releng/templatetags/host_from_url.py
new file mode 100644
index 0000000..bc7a851
--- /dev/null
+++ b/releng/templatetags/host_from_url.py
@@ -0,0 +1,10 @@
+from django import template
+import string
+
+register = template.Library()
+
+ at register.filter(name='host_from_url')
+def host_from_url(val):
+    return string.split(val, "/", 3)[2]
+
+# vim: set ts=4 sw=4 et:
diff --git a/releng/urls.py b/releng/urls.py
index be94404..6fbea3f 100644
--- a/releng/urls.py
+++ b/releng/urls.py
@@ -1,6 +1,7 @@
-from django.conf.urls import include, patterns
+from django.conf.urls import include, patterns, url
 
 from .views import ReleaseListView, ReleaseDetailView
+from django.views.generic import RedirectView
 
 feedback_patterns = patterns('releng.views',
     (r'^$',                              'test_results_overview', {}, 'releng-test-overview'),
@@ -21,9 +22,27 @@
 )
 
 netboot_patterns = patterns('releng.views',
-    (r'^$',                 'netboot_info', {}, 'releng-netboot-info'),
+    (r'^$',                    'netboot_info',        {}, 'releng-netboot-info'),
+    (r'^pxelinux_vesa.cfg',    'netboot_config_is64', { 'style': 'vesa' }),
+    (r'^pxelinux_text.cfg',    'netboot_config_is64', { 'style': 'text' }),
+    (r'^pxelinux_vesa_64.cfg', 'netboot_config',      { 'style': 'vesa', 'arch': 64 }),
+    (r'^pxelinux_vesa_32.cfg', 'netboot_config',      { 'style': 'vesa', 'arch': 32 }),
+    (r'^pxelinux_text_64.cfg', 'netboot_config',      { 'style': 'text', 'arch': 64 }),
+    (r'^pxelinux_text_32.cfg', 'netboot_config',      { 'style': 'text', 'arch': 32 }),
 )
 
+netboot_patterns += [ url(r'^' + rfile + '$', RedirectView.as_view(url='http://releng.archlinux.org/pxeboot/boot/' + rfile)) for rfile in
+                     ('hdt.c32'
+                      'hdt/modalias.gz'
+                      'hdt/pciids.gz'
+                      'ifcpu64.c32',
+                      'memtest.bin'
+                      'menu.c32',
+                      'pxelinux.0',
+                      'reboot.c32',
+                      'splash.png',
+                      'vesamenu.c32') ]
+
 urlpatterns = patterns('',
     (r'^feedback/', include(feedback_patterns)),
     (r'^releases/', include(releases_patterns)),
diff --git a/releng/views.py b/releng/views.py
index e3a58bb..8464500 100644
--- a/releng/views.py
+++ b/releng/views.py
@@ -10,7 +10,7 @@
 from .models import (Architecture, BootType, Bootloader, ClockChoice,
         Filesystem, HardwareType, InstallType, Iso, IsoType, Module, Source,
         Test, Release)
-
+from mirrors.models import (Mirror, MirrorUrl, MirrorProtocol)
 
 def standard_field(model, empty_label=None, help_text=None, required=True):
     return forms.ModelChoiceField(queryset=model.objects.all(),
@@ -242,4 +242,29 @@ def release_torrent(request, version):
 def netboot_info(request):
     return render(request, "releng/netboot.html", None)
 
+def netboot_config_is64(request, style):
+    context = {
+        'style': style
+    }
+    return render(request, "releng/pxelinux_choose.cfg.txt", context, content_type='text/plain')
+
+def netboot_config(request, style, arch):
+    releases = [ release.version for release in Release.objects.filter(available=True).order_by("-release_date") ]
+    if arch == 64:
+        archs = ['x86_64', 'i686']
+    else:
+        archs = ['i686']
+    mirrorurls = sorted( MirrorUrl.objects.filter(active=True, protocol__protocol='http',
+                                                  mirror__public=True, mirror__active=True,
+                                                  mirror__isos=True),
+                         key=lambda x: x.country.name)
+    context = {
+        'style': style,
+        'arch': arch,
+        'archs': archs,
+        'releases': releases,
+        'mirrorurls': mirrorurls,
+    }
+    return render(request, "releng/pxelinux.cfg.txt", context, content_type='text/plain')
+
 # vim: set ts=4 sw=4 et:
diff --git a/sitestatic/netboot/pxe/hdt.c32 b/sitestatic/netboot/pxe/hdt.c32
new file mode 100644
index 0000000..66fdce7
Binary files /dev/null and b/sitestatic/netboot/pxe/hdt.c32 differ
diff --git a/sitestatic/netboot/pxe/hdt/modalias.gz b/sitestatic/netboot/pxe/hdt/modalias.gz
new file mode 100644
index 0000000..6444e4b
Binary files /dev/null and b/sitestatic/netboot/pxe/hdt/modalias.gz differ
diff --git a/sitestatic/netboot/pxe/hdt/pciids.gz b/sitestatic/netboot/pxe/hdt/pciids.gz
new file mode 100644
index 0000000..2ecd1d2
Binary files /dev/null and b/sitestatic/netboot/pxe/hdt/pciids.gz differ
diff --git a/sitestatic/netboot/pxe/ifcpu64.c32 b/sitestatic/netboot/pxe/ifcpu64.c32
new file mode 100644
index 0000000..04d7c25
Binary files /dev/null and b/sitestatic/netboot/pxe/ifcpu64.c32 differ
diff --git a/sitestatic/netboot/pxe/memtest.bin b/sitestatic/netboot/pxe/memtest.bin
new file mode 100644
index 0000000..293e15d
Binary files /dev/null and b/sitestatic/netboot/pxe/memtest.bin differ
diff --git a/sitestatic/netboot/pxe/menu.c32 b/sitestatic/netboot/pxe/menu.c32
new file mode 100644
index 0000000..24ccbcd
Binary files /dev/null and b/sitestatic/netboot/pxe/menu.c32 differ
diff --git a/sitestatic/netboot/pxe/pxelinux.0 b/sitestatic/netboot/pxe/pxelinux.0
new file mode 100644
index 0000000..119cb32
Binary files /dev/null and b/sitestatic/netboot/pxe/pxelinux.0 differ
diff --git a/sitestatic/netboot/pxe/reboot.c32 b/sitestatic/netboot/pxe/reboot.c32
new file mode 100644
index 0000000..e09d8db
Binary files /dev/null and b/sitestatic/netboot/pxe/reboot.c32 differ
diff --git a/sitestatic/netboot/pxe/splash.png b/sitestatic/netboot/pxe/splash.png
new file mode 100644
index 0000000..64b959a
Binary files /dev/null and b/sitestatic/netboot/pxe/splash.png differ
diff --git a/sitestatic/netboot/pxe/vesamenu.c32 b/sitestatic/netboot/pxe/vesamenu.c32
new file mode 100644
index 0000000..a931372
Binary files /dev/null and b/sitestatic/netboot/pxe/vesamenu.c32 differ
diff --git a/templates/releng/pxelinux.cfg.txt b/templates/releng/pxelinux.cfg.txt
new file mode 100644
index 0000000..8499eb6
--- /dev/null
+++ b/templates/releng/pxelinux.cfg.txt
@@ -0,0 +1,118 @@
+SERIAL 0 38400
+{% if style == 'vesa' %}
+UI vesamenu.c32
+MENU BACKGROUND splash.png
+
+MENU WIDTH 78
+MENU MARGIN 4
+MENU ROWS 11
+MENU VSHIFT 10
+MENU TIMEOUTROW 17
+MENU TABMSGROW 15
+MENU CMDLINEROW 17
+MENU HELPMSGROW 17
+MENU HELPMSGENDROW -1
+
+# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
+MENU COLOR border       30;44   #40ffffff #a0000000 std
+MENU COLOR title        1;36;44 #9033ccff #a0000000 std
+MENU COLOR sel          7;37;40 #e0ffffff #20ffffff all
+MENU COLOR unsel        37;44   #50ffffff #a0000000 std
+MENU COLOR help         37;40   #c0ffffff #a0000000 std
+MENU COLOR timeout_msg  37;40   #80ffffff #00000000 std
+MENU COLOR timeout      1;37;40 #c0ffffff #00000000 std
+MENU COLOR msg07        37;40   #90ffffff #a0000000 std
+MENU COLOR tabmsg       31;40   #30ffffff #00000000 std
+{% elif style == 'text' %}
+UI menu.c32
+
+MENU WIDTH 80
+MENU MARGIN 2
+MENU ROWS 14
+MENU VSHIFT 1
+MENU TIMEOUTROW 21
+MENU TABMSGROW 19
+MENU CMDLINEROW 21
+MENU HELPMSGROW 21
+MENU HELPMSGENDROW -1
+{% endif %}
+PROMPT 0
+MENU TITLE Arch Linux
+{% load host_from_url %}{% for a in archs %}
+MENU BEGIN release_{{ a }}
+  MENU TITLE Official Releases ({{ a }})
+
+  LABEL -
+  MENU LABEL back
+  MENU EXIT
+
+  MENU SEPARATOR
+{% for release in releases %}
+  MENU BEGIN release_{{ release }}_{{ a }}
+    MENU TITLE {{ release }} ({{ a }})
+
+    LABEL -
+    MENU LABEL back
+    MENU EXIT
+
+    MENU SEPARATOR
+{% regroup mirrorurls by country as mirrors_by_country %}{% for mirrorgroup in mirrors_by_country %}
+    MENU BEGIN release_{{ release }}_{{ a }}_{{ mirrorgroup.grouper }}
+      MENU TITLE {{ release }} ({{ a }}), {{ mirrorgroup.grouper.name }}
+
+      LABEL -
+      MENU LABEL back
+      MENU EXIT
+
+      MENU SEPARATOR
+{% for mirror in mirrorgroup.list %}
+      LABEL release_{{ release }}_{{ a }}_{{ mirrorgroup.grouper }}_{{ mirror.url|host_from_url }}
+      TEXT HELP
+      Boot Arch Linux ({{ a }}) live medium.
+      Release {{ release }}, mirror {{ mirror.url|host_from_url }}.
+      ENDTEXT
+      MENU LABEL {{ mirror.url|host_from_url }}
+      LINUX {{ mirror.url }}iso/{{ release }}/arch/boot/{{ a }}/vmlinuz
+      INITRD {{ mirror.url }}iso/{{ release }}/arch/boot/{{ a }}/archiso.img
+      APPEND archiso_http_srv={{ mirror.url }}iso/{{ release }}/ archisobasedir=arch checksum=y ip=dhcp
+{% endfor %}
+    MENU END
+{% endfor %}
+  MENU END
+{% endfor %}
+MENU END
+{% endfor %}
+MENU BEGIN hardware
+MENU TITLE Hardware Information
+
+LABEL -
+MENU LABEL back
+MENU EXIT
+
+MENU SEPARATOR
+
+# http://www.memtest.org/
+LABEL memtest
+MENU LABEL Run Memtest86+ (RAM test)
+LINUX memtest.bin
+
+# http://hdt-project.org/
+LABEL hdt
+MENU LABEL Hardware Information (HDT)
+COM32 hdt.c32
+APPEND modules_alias=hdt/modalias.gz pciids=hdt/pciids.gz
+
+MENU END
+
+LABEL reboot
+MENU LABEL Reboot
+COM32 reboot.c32
+{% if style == 'vesa' %}
+LABEL totext
+MENU LABEL Switch to text mode
+CONFIG pxelinux_text_{{ arch }}.cfg
+{% elif style == 'text' %}
+LABEL tograph
+MENU LABEL Switch to graphical mode
+CONFIG pxelinux_vesa_{{ arch }}.cfg
+{% endif %}
diff --git a/templates/releng/pxelinux_choose.cfg.txt b/templates/releng/pxelinux_choose.cfg.txt
new file mode 100644
index 0000000..e1c7922
--- /dev/null
+++ b/templates/releng/pxelinux_choose.cfg.txt
@@ -0,0 +1,13 @@
+SERIAL 0 38400
+DEFAULT choose
+PROMPT 0
+
+LABEL choose
+KERNEL ifcpu64.c32
+APPEND have64 -- nohave64
+
+LABEL have64
+CONFIG pxelinux_{{ style }}_64.cfg
+
+LABEL nohave64
+CONFIG pxelinux_{{ style }}_32.cfg
-- 
1.8.3.1



More information about the arch-projects mailing list