summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-25 17:12:49 +0100
committerSimon Rettberg2019-03-25 17:12:49 +0100
commitd76372a64f9f4fa60f0818e9e597613cfce7d496 (patch)
tree0f2b1ad8bc1467b7193c067ba6ccf12b6c2163fb
parent[serversetup-bwlp-ipxe] Fix type error (BootEntry vs PxeSection) (diff)
downloadslx-admin-d76372a64f9f4fa60f0818e9e597613cfce7d496.tar.gz
slx-admin-d76372a64f9f4fa60f0818e9e597613cfce7d496.tar.xz
slx-admin-d76372a64f9f4fa60f0818e9e597613cfce7d496.zip
[serversetup-bwlp-ipxe] Support DEFAULT directive of pxelinux
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php4
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php18
2 files changed, 21 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
index a78ad941..2aecd70f 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php
@@ -162,8 +162,10 @@ class IPxe
if (!empty($pxe->title)) {
$menuTitle = $pxe->title;
}
- if ($pxe->timeoutLabel !== null) {
+ if ($pxe->timeoutLabel !== null && $pxe->hasLabel($pxe->timeoutLabel)) {
$defaultLabel = $pxe->timeoutLabel;
+ } elseif ($pxe->hasLabel($pxe->default)) {
+ $defaultLabel = $pxe->default;
}
$timeoutMs[] = $pxe->timeoutMs;
$timeoutMs[] = $pxe->totalTimeoutMs;
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
index a3826c2e..63fdf674 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/pxelinux.inc.php
@@ -38,6 +38,7 @@ class PxeLinux
'menu clear' => ['true', 'menuClear'],
'menu immediate' => ['true', 'immediateHotkeys'],
'ontimeout' => ['string', 'timeoutLabel'],
+ 'default' => ['string', 'default'],
];
$lines = preg_split('/[\r\n]+/', $input);
$section = null;
@@ -159,6 +160,11 @@ class PxeMenu
* @var PxeSection[] list of sections the menu contains
*/
public $sections = [];
+ /**
+ * @var string The DEFAULT entry of the menu. Usually refers either to a
+ * LABEL, or a loadable module (like vesamenu.c32)
+ */
+ public $default;
public function hash($fuzzy)
{
@@ -193,6 +199,18 @@ class PxeMenu
return hash_final($ctx, false);
}
+ /**
+ * Check if any of the sections has the given label.
+ */
+ public function hasLabel($label)
+ {
+ foreach ($this->sections as $section) {
+ if ($section->label === $label)
+ return true;
+ }
+ return false;
+ }
+
}
/**