summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-25 17:13:15 +0100
committerSimon Rettberg2019-03-25 17:13:15 +0100
commit43f5238ea4b1ab62aeff74233f45a3160e863680 (patch)
treeb74c6588d9fc7c0483504281a386250737e650b3
parent[serversetup-bwlp-ipxe] Support DEFAULT directive of pxelinux (diff)
downloadslx-admin-43f5238ea4b1ab62aeff74233f45a3160e863680.tar.gz
slx-admin-43f5238ea4b1ab62aeff74233f45a3160e863680.tar.xz
slx-admin-43f5238ea4b1ab62aeff74233f45a3160e863680.zip
[serversetup-bwlp-ipxe] Direct boot for menus with one item
-rw-r--r--modules-available/serversetup-bwlp-ipxe/api.inc.php9
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php23
2 files changed, 31 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/api.inc.php b/modules-available/serversetup-bwlp-ipxe/api.inc.php
index 0d59ea1d..67da6727 100644
--- a/modules-available/serversetup-bwlp-ipxe/api.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/api.inc.php
@@ -76,7 +76,12 @@ if ($menu !== false) {
$menu = IPxeMenu::forClient($ip, $uuid);
$initLabel = 'init';
}
-
+// If this is a menu with a single item, treat a timeout of 0 as "boot immediately" instead of "infinite"
+if ($menu->itemCount() === 1 && $menu->timeoutMs() === 0 && ($tmp = $menu->getDefaultScriptLabel()) !== false) {
+ $directBoot = "goto $tmp ||";
+} else {
+ $directBoot = '';
+}
// Get preferred localboot method, depending on system model
$localboot = false;
@@ -177,6 +182,8 @@ set serverip $serverIp ||
# Clean up in case we've been chained to
imgfree ||
+$directBoot
+
imgfetch --name bg-menu /tftp/pxe-menu.png ||
:start
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php
index 991ee403..f437c447 100644
--- a/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxemenu.inc.php
@@ -71,6 +71,29 @@ class IPxeMenu
return $str;
}
+ public function timeoutMs()
+ {
+ return $this->timeoutMs;
+ }
+
+ /**
+ * @return int Number of items in this menu
+ */
+ public function itemCount()
+ {
+ return count($this->items);
+ }
+
+ /**
+ * @return string|false Return script label of default entry, false if not set
+ */
+ public function getDefaultScriptLabel()
+ {
+ if ($this->defaultEntryId !== null)
+ return "m_{$this->menuid}_{$this->defaultEntryId}";
+ return false;
+ }
+
/*
*
*/