summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-20 16:40:25 +0200
committerSimon Rettberg2021-04-20 16:40:25 +0200
commit7c5748d3a6bc12ece61ccf782047f6200b79b325 (patch)
treed409550975adb7e014dd919892d4e110e55f62c4 /modules-available
parent[sysconfig] Enforce proper ldadp services running on reboot/install (diff)
downloadslx-admin-7c5748d3a6bc12ece61ccf782047f6200b79b325.tar.gz
slx-admin-7c5748d3a6bc12ece61ccf782047f6200b79b325.tar.xz
slx-admin-7c5748d3a6bc12ece61ccf782047f6200b79b325.zip
[serversetup-bwlp-ipxe] Add iPXE version selector
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/serversetup-bwlp-ipxe/hooks/ipxe-update.inc.php16
-rw-r--r--modules-available/serversetup-bwlp-ipxe/inc/ipxebuilder.inc.php82
-rw-r--r--modules-available/serversetup-bwlp-ipxe/lang/de/module.json2
-rw-r--r--modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json11
-rw-r--r--modules-available/serversetup-bwlp-ipxe/lang/en/module.json2
-rw-r--r--modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json11
-rw-r--r--modules-available/serversetup-bwlp-ipxe/page.inc.php65
-rw-r--r--modules-available/serversetup-bwlp-ipxe/templates/git_task.html15
-rw-r--r--modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html114
-rw-r--r--modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html28
10 files changed, 267 insertions, 79 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/hooks/ipxe-update.inc.php b/modules-available/serversetup-bwlp-ipxe/hooks/ipxe-update.inc.php
index c58a64ae..f645e9e7 100644
--- a/modules-available/serversetup-bwlp-ipxe/hooks/ipxe-update.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/hooks/ipxe-update.inc.php
@@ -1,12 +1,20 @@
<?php
+$get = Module::get('serversetup');
+if ($get === false)
+ return;
+
+$get->activate(1, false);
+
$data = [
- 'ipaddress' => Property::getServerIp()
+ 'ipaddress' => Property::getServerIp(),
+ 'parentTask' => $taskId,
];
if ($data['ipaddress'] === 'invalid')
- return false;
+ return null;
$task = Taskmanager::submit('CompileIPxeNew', $data);
if (Taskmanager::isFailed($task))
- return false;
-Property::set('ipxe-task-id', $task['id'], 15);
+ return null;
+TaskmanagerCallback::addCallback($task, 'ipxeCompileDone');
+Property::set(IPxeBuilder::PROP_IPXE_COMPILE_TASKID, $task['id'], 15);
return $task['id']; \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxebuilder.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxebuilder.inc.php
new file mode 100644
index 00000000..d6633f67
--- /dev/null
+++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxebuilder.inc.php
@@ -0,0 +1,82 @@
+<?php
+
+class IPxeBuilder
+{
+
+ const PROP_IPXE_BUILDSTRING = 'ipxe.compile-time';
+ const PROP_IPXE_HASH = 'ipxe.commit-hash';
+ const PROP_IPXE_COMPILE_TASKID = 'ipxe-task-id';
+ const VERSION_LIST_TASK = 'ipxe-version-list-id';
+ const PROP_VERSION_SELECT_TASKID = 'ipxe-version-select-id';
+
+ /**
+ * Checkout given commit/ref of ipxe repo. Returns the according task-id, or null on error
+ *
+ * @param string $version version ref (commit, tag, ...)
+ * @param string|null $parent parent task id
+ * @return ?string
+ */
+ public static function setIpxeVersion($version, $parent = null)
+ {
+ $task = Taskmanager::submit('IpxeVersion', [
+ 'action' => 'CHECKOUT',
+ 'ref' => $version,
+ 'parentTask' => $parent,
+ ]);
+ if (!Taskmanager::isTask($task))
+ return null;
+ TaskmanagerCallback::addCallback($task, 'ipxeVersionSet');
+ Property::set(IPxeBuilder::PROP_VERSION_SELECT_TASKID, $task['id'], 2);
+ return $task['id'];
+ }
+
+ /**
+ * @return array|false
+ */
+ public static function getVersionTaskResult()
+ {
+ $task = Taskmanager::status(IPxeBuilder::VERSION_LIST_TASK);
+ if (!Taskmanager::isTask($task) || Taskmanager::isFailed($task)) {
+ $task = Taskmanager::submit('IpxeVersion',
+ ['id' => IPxeBuilder::VERSION_LIST_TASK, 'action' => 'LIST']);
+ }
+ $task = Taskmanager::waitComplete($task);
+ if (Taskmanager::isFinished($task) && !Taskmanager::isFailed($task)) {
+ return $task['data'];
+ }
+ return false;
+ }
+
+ /**
+ * Callback when compile Taskmanager job finished
+ */
+ public static function compileCompleteCallback($task)
+ {
+ if (!Taskmanager::isFinished($task) || Taskmanager::isFailed($task))
+ return;
+ $version = 'Unknown';
+ if (isset($task['data']['hash'])) {
+ $hash = $task['data']['hash'];
+ Property::set(IPxeBuilder::PROP_IPXE_HASH, $hash);
+ $version = $hash;
+ $list = IPxeBuilder::getVersionTaskResult();
+ if (isset($list['versions'])) {
+ foreach ($list['versions'] as $v) {
+ if ($v['hash'] === $version) {
+ $version = date('Y-m-d H:i', $v['date']) . ' (' . substr($version, 0, 7) . ')';
+ break;
+ }
+ }
+ }
+ }
+ $buildString = date('d.m.Y H:i') . ', Version: ' . $version;
+ Property::set(IPxeBuilder::PROP_IPXE_BUILDSTRING, $buildString);
+ }
+
+ public static function setIPxeVersionCallback($task)
+ {
+ if (!Taskmanager::isFinished($task) || Taskmanager::isFailed($task) || empty($task['data']['ref']))
+ return;
+ Property::set(IPxeBuilder::PROP_IPXE_HASH, $task['data']['ref']);
+ }
+} \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/de/module.json b/modules-available/serversetup-bwlp-ipxe/lang/de/module.json
index f95573a2..43209a2e 100644
--- a/modules-available/serversetup-bwlp-ipxe/lang/de/module.json
+++ b/modules-available/serversetup-bwlp-ipxe/lang/de/module.json
@@ -11,7 +11,7 @@
"dl-x86_64": "64\u2009Bit",
"module_name": "iPXE \/ Boot Menu",
"page_title": "PXE- und Boot-Einstellungen",
- "submenu_address": "Server-Adresse festlegen",
+ "submenu_address": "Boot-IP \/ iPXE-Version setzen",
"submenu_bootentry": "Men\u00fceintr\u00e4ge verwalten",
"submenu_download": "Downloads",
"submenu_import": "Importieren",
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json
index 4335adc5..eba15cbe 100644
--- a/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json
+++ b/modules-available/serversetup-bwlp-ipxe/lang/de/template-tags.json
@@ -36,8 +36,10 @@
"lang_execImageFree": "Andere geladene Images vor dem Ausf\u00fchren entladen (imgfree)",
"lang_execReplace": "Aktuellen iPXE-Stack ersetzen (--replace)",
"lang_execResetConsole": "Konsole vor Ausf\u00fchrung zur\u00fccksetzen",
+ "lang_fetchUpdate": "Updates laden",
"lang_forceRecompile": "Jetzt neu kompilieren",
"lang_generationFailed": "Erzeugen des Bootmen\u00fcs fehlgeschlagen. Der Netzwerkboot von bwLehrpool wird wahrscheinlich nicht funktionieren. Wenn Sie den Fehler nicht selbst beheben k\u00f6nnen, melden Sie bitte die Logausgabe an das bwLehrpool-Projekt.",
+ "lang_gitCheckout": "git-Ausgabe",
"lang_hex": "Hex",
"lang_hookExtraOptionHeading": "Weitere Angaben",
"lang_hookOfModule": "Eintrag von",
@@ -49,6 +51,7 @@
"lang_ipxeSettings": "iPXE-spezifische Einstellungen",
"lang_ipxeWikiUrl": "im iPXE Wiki",
"lang_isDefault": "Standard",
+ "lang_lastBuild": "Letzter erfolgreicher Bauvorgang",
"lang_listOfMenus": "Men\u00fcliste",
"lang_localBootDefault": "Standardm\u00e4\u00dfig verwendete Methode, um von Festplatte zu booten",
"lang_localBootExceptions": "Ausnahmen, pro Rechnermodell definierbar",
@@ -71,9 +74,12 @@
"lang_pxelinuxEntriesOnly": "Nur Eintr\u00e4ge importieren, kein Men\u00fc erzeugen",
"lang_pxelinuxImport": "PXE-Men\u00fc importieren",
"lang_pxelinuxImportIntro": "Hier k\u00f6nnen Sie ein PXE-Men\u00fc einf\u00fcgen und in entsprechende Men\u00fceintr\u00e4ge f\u00fcr iPXE umwandeln lassen.",
- "lang_recompileHint": "iPXE-Binaries jetzt neu kompilieren. Normalerweise wird dieser Vorgang bei \u00c4nderungen automatisch ausgef\u00fchrt. Sollten Bootprobleme auftreten, k\u00f6nnen Sie hier den Vorgang manuell ansto\u00dfen.",
+ "lang_reallyGitReset": "Wollen Sie wirklich alle \u00c4nderungen am iPXE-Sourcecode zur\u00fccksetzen?",
+ "lang_recompileHead": "iPXE-Binaries jetzt neu kompilieren",
+ "lang_recompileHint": "Normalerweise wird dieser Vorgang bei \u00c4nderungen automatisch ausgef\u00fchrt. Sollten Bootprobleme auftreten, k\u00f6nnen Sie hier den Vorgang manuell ansto\u00dfen. Au\u00dferdem k\u00f6nnen Sie hier explizit einen Versionsstand ausw\u00e4hlen. Durch \u00e4nderungen und Bugfixes am iPXE-Code kann es zu Regressionen kommen, d.h., dass bestimmte Hardware m\u00f6glicherweise mit neueren Versionen nicht mehr Bootet. In diesem Fall ist ein Wechsel auf eine \u00e4ltere Version eine vor\u00fcbergehende L\u00f6sung. Ansonsten ist es zu empfehlen, immer bei der aktuellen Version zu bleiben.",
"lang_refCount": "Referenzen",
"lang_referencingMenus": "Verkn\u00fcpfte Men\u00fcs",
+ "lang_resetWorkingTree": "git-Repo zur\u00fccksetzen",
"lang_saveAndReload": "Speichern und neu laden",
"lang_scriptContent": "Skript",
"lang_seconds": "Sekunden",
@@ -87,5 +93,6 @@
"lang_usbImgHelpLinux": "Nutzen Sie dd, um das Image auf einen USB-Stick zu schreiben. Das Image enth\u00e4lt bereits eine Partitionstabelle, achten Sie daher darauf, dass Sie das Image z.B. nach \/dev\/sdx schreiben, und nicht nach \/dev\/sdx1",
"lang_usbImgHelpWindows": "Unter Windows muss zun\u00e4chst ein Programm besorgt werden, mit dem sich Images direkt auf einen USB-Stick schreiben lassen. Es gibt gleich mehrere kostenlose und quelloffene Programme, eines davon ist Rufus. Rufus wurde mit dem bwLehrpool-Image gestetet. Nach dem Starten des Programms ist lediglich das heruntergeladene Image zu \u00f6ffnen, sowie in der Liste der Laufwerke der richtige USB-Stick auszuw\u00e4hlen (damit Sie nicht versehentlich Daten auf dem falschen Laufwerk \u00fcberschreiben!)",
"lang_useDefaultMenu": "\u00dcbergeordnetes Men\u00fc verwenden",
- "lang_useDefaultMenuEntry": "(Vorgabe des Men\u00fcs)"
+ "lang_useDefaultMenuEntry": "(Vorgabe des Men\u00fcs)",
+ "lang_versionSelect": "iPXE-Version ausw\u00e4hlen"
} \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/en/module.json b/modules-available/serversetup-bwlp-ipxe/lang/en/module.json
index 30865907..643e51ba 100644
--- a/modules-available/serversetup-bwlp-ipxe/lang/en/module.json
+++ b/modules-available/serversetup-bwlp-ipxe/lang/en/module.json
@@ -11,7 +11,7 @@
"dl-x86_64": "64 bit",
"module_name": "iPXE \/ Boot Menu",
"page_title": "iPXE and boot settings",
- "submenu_address": "Server address",
+ "submenu_address": "Set boot IP \/ iPXE version",
"submenu_bootentry": "Manage menu items",
"submenu_download": "Downloads",
"submenu_import": "Import",
diff --git a/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json b/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json
index 91d48e5d..304884a5 100644
--- a/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json
+++ b/modules-available/serversetup-bwlp-ipxe/lang/en/template-tags.json
@@ -36,8 +36,10 @@
"lang_execImageFree": "Unload any other images before execution (imgfree)",
"lang_execReplace": "Replace current iPXE stack (--replace)",
"lang_execResetConsole": "Reset console before execution",
+ "lang_fetchUpdate": "Fetch updates",
"lang_forceRecompile": "Force recompile",
"lang_generationFailed": "Could not generate boot menu. The bwLehrpool-System might not work properly. If you can't fix the problem, please report the error log below to the bwLehrpool project.",
+ "lang_gitCheckout": "git output",
"lang_hex": "Hex",
"lang_hookExtraOptionHeading": "Extra Options",
"lang_hookOfModule": "Entry of",
@@ -49,6 +51,7 @@
"lang_ipxeSettings": "iPXE-specific settings",
"lang_ipxeWikiUrl": "at the iPXE wiki",
"lang_isDefault": "Default",
+ "lang_lastBuild": "Last successful build",
"lang_listOfMenus": "Menulist",
"lang_localBootDefault": "Default method to use for booting from disk",
"lang_localBootExceptions": "Exceptions to the local boot method, defined per system model",
@@ -71,9 +74,12 @@
"lang_pxelinuxEntriesOnly": "Import menu items only, don't create menu",
"lang_pxelinuxImport": "Import PXELinux menu",
"lang_pxelinuxImportIntro": "Here you can paste a pxelinux menu to convert it to an iPXE menu.",
- "lang_recompileHint": "Recompile iPXE binaries now. Usually this happens automatically on changes, but if you suspect problems caused by outdated binaries, you can trigger recompilation here.",
+ "lang_reallyGitReset": "Do you really want to reset the iPXE source code and revert any local changes?",
+ "lang_recompileHead": "Recompile iPXE binaries now",
+ "lang_recompileHint": "Usually this happens automatically on changes, but if you suspect problems caused by outdated binaries, you can trigger recompilation here. You can also specify the iPXE version to use here. Although it is generally recommended to use the latest version, this might be useful if a regression occurs, i.e. some bugfix or other change in a newer version breaks booting specific hardware that was previously supported.",
"lang_refCount": "References",
"lang_referencingMenus": "Referencing menus",
+ "lang_resetWorkingTree": "Reset git repository",
"lang_saveAndReload": "Save and Reload",
"lang_scriptContent": "Script content",
"lang_seconds": "Seconds",
@@ -87,5 +93,6 @@
"lang_usbImgHelpLinux": "On Linux you can simply use dd to write the image to a usb stick. The image already contains a partition table, so make sure you write the image to the device itself and not to an already existing partition (e.g. to \/dev\/sdx not \/dev\/sdx1)",
"lang_usbImgHelpWindows": "On Windows you need to use a 3rd party tool that can directly write to usb sticks. There are several free and open source soltions, one of them being Rufus. Rufus has been tested with the bwLehrpool image and is very simple to use. After launching Rufus, just open the downloaded USB image, select the proper USB stick to write to (be careful not to overwrite the wrong drive!), and you're ready to go.",
"lang_useDefaultMenu": "Inherit from parent location",
- "lang_useDefaultMenuEntry": "(Menu default)"
+ "lang_useDefaultMenuEntry": "(Menu default)",
+ "lang_versionSelect": "Select iPXE version"
} \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp-ipxe/page.inc.php b/modules-available/serversetup-bwlp-ipxe/page.inc.php
index bc13ab6a..f0422fd3 100644
--- a/modules-available/serversetup-bwlp-ipxe/page.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/page.inc.php
@@ -6,14 +6,13 @@ class Page_ServerSetup extends Page
private $addrListTask;
private $compileTask = null;
private $currentAddress;
- private $currentMenu;
private $hasIpSet = false;
private function getCompileTask()
{
if ($this->compileTask !== null)
return $this->compileTask;
- $this->compileTask = Property::get('ipxe-task-id');
+ $this->compileTask = Property::get(IPxeBuilder::PROP_IPXE_COMPILE_TASKID);
if ($this->compileTask !== false) {
$this->compileTask = Taskmanager::status($this->compileTask);
if (!Taskmanager::isTask($this->compileTask) || Taskmanager::isFinished($this->compileTask)) {
@@ -37,7 +36,10 @@ class Page_ServerSetup extends Page
$this->handleGetImage();
}
- $this->currentMenu = Property::getBootMenu();
+ if (User::hasPermission('edit.address')) {
+ Taskmanager::submit('IpxeVersion',
+ ['id' => IPxeBuilder::VERSION_LIST_TASK, 'action' => 'LIST'], true);
+ }
$action = Request::post('action');
@@ -49,9 +51,20 @@ class Page_ServerSetup extends Page
if ($action === 'compile') {
User::assertPermission("edit.address");
if ($this->getCompileTask() === false) {
- Trigger::ipxe();
+ $taskId = IPxeBuilder::setIpxeVersion(Request::post('version', false, 'string'));
+ Trigger::ipxe($taskId);
}
- Util::redirect('?do=serversetup');
+ Util::redirect('?do=serversetup&show=address&sv=1');
+ }
+ if ($action === 'fetch' || $action === 'reset') {
+ User::assertPermission("edit.address");
+ if ($this->getCompileTask() === false) {
+ $task = Taskmanager::submit('IpxeVersion', ['action' => strtoupper($action)]);
+ if (Taskmanager::isTask($task)) {
+ Property::set(IPxeBuilder::PROP_VERSION_SELECT_TASKID, $task['id'], 2);
+ }
+ }
+ Util::redirect('?do=serversetup&show=address&sv=1');
}
if ($action === 'ip') {
@@ -130,12 +143,13 @@ class Page_ServerSetup extends Page
}
if (Request::get('show') === false) {
$subs = Dashboard::getSubmenus();
+ $sv = Request::get('sv') ? '&sv=' . Request::get('sv') : '';
if (empty($subs)) {
User::assertPermission('download');
} elseif ($addr && !preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', Property::getServerIp())) {
- Util::redirect('?do=serversetup&show=address');
+ Util::redirect('?do=serversetup&show=address' . $sv);
} else {
- Util::redirect($subs[0]['url']);
+ Util::redirect($subs[0]['url'] . $sv);
}
}
}
@@ -147,15 +161,22 @@ class Page_ServerSetup extends Page
$show = Request::get('show');
if (in_array($show, ['menu', 'address', 'download'])) {
- $task = $this->getCompileTask();
- if ($task !== false) {
+ $selectTask = Taskmanager::status(Property::get(IPxeBuilder::PROP_VERSION_SELECT_TASKID));
+ $buildTask = $this->getCompileTask();
+ if ($buildTask !== false || Taskmanager::isRunning($selectTask) || Request::get('sv')) {
+ Render::addTemplate('git_task', [
+ 'selectTask' => Property::get(IPxeBuilder::PROP_VERSION_SELECT_TASKID),
+ 'reload' => Taskmanager::isRunning($selectTask),
+ ]);
+ }
+ if ($buildTask !== false) {
$files = [];
- if ($task['data'] && $task['data']['files']) {
- foreach ($task['data']['files'] as $k => $v) {
+ if ($buildTask['data'] && $buildTask['data']['files']) {
+ foreach ($buildTask['data']['files'] as $k => $v) {
$files[] = ['name' => $k, 'namehyphen' => str_replace(['/', '.'], '-', $k)];
}
}
- Render::addTemplate('ipxe_update', array('taskid' => $task['id'], 'files' => $files));
+ Render::addTemplate('ipxe_update', ['taskid' => $buildTask['id'], 'files' => $files]);
}
}
@@ -572,10 +593,30 @@ class Page_ServerSetup extends Page
private function showEditAddress()
{
+ $status = IPxeBuilder::getVersionTaskResult();
+ $versions = false;
+ if ($status === false) {
+ $error = 'Taskmanager down';
+ } elseif (!empty($status['versions'])) {
+ $versions = $status['versions'];
+ foreach ($versions as &$version) {
+ if ($version['hash'] === Property::get(IPxeBuilder::PROP_IPXE_HASH)) {
+ $version['hash_selected'] = 'selected';
+ }
+ $version['date_s'] = date('Y-m-d H:i', $version['date']);
+ $version['hash_s'] = substr($version['hash'], 0, 7);
+ }
+ $error = false;
+ } else {
+ $error = $status['error'] ?? 'Unknown error';
+ }
Render::addTemplate('ipaddress', array(
'ips' => $this->addrListTask['data']['addresses'],
'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger',
'disabled' => ($this->getCompileTask() === false) ? '' : 'disabled',
+ 'versions' => $versions,
+ 'error' => $error,
+ 'lastBuild' => Property::get(IPxeBuilder::PROP_IPXE_BUILDSTRING),
));
}
diff --git a/modules-available/serversetup-bwlp-ipxe/templates/git_task.html b/modules-available/serversetup-bwlp-ipxe/templates/git_task.html
new file mode 100644
index 00000000..7f199256
--- /dev/null
+++ b/modules-available/serversetup-bwlp-ipxe/templates/git_task.html
@@ -0,0 +1,15 @@
+<div id="tm-select-div" data-tm-id="{{selectTask}}" data-tm-log="error" data-tm-callback="ipxeSelVersionCb">
+ {{lang_gitCheckout}}
+</div>
+<script type="text/javascript">
+ function ipxeSelVersionCb(task) {
+ {{#reload}}
+ if (!task || !task.statusCode)
+ return;
+
+ if (task.statusCode === 'TASK_FINISHED') {
+ window.location.href = '?do=serversetup&show=address&sv=0';
+ }
+ {{/reload}}
+ }
+</script> \ No newline at end of file
diff --git a/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html b/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html
index 74affb9f..f5a49beb 100644
--- a/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html
+++ b/modules-available/serversetup-bwlp-ipxe/templates/ipaddress.html
@@ -1,46 +1,72 @@
-<div class="panel panel-default">
- <div class="panel-heading">
- {{lang_bootAddress}}
+<h3>
+ {{lang_bootAddress}}
+</h3>
+<div class="{{chooseHintClass}}">
+ {{lang_chooseIP}}
+</div>
+<form method="post" action="?do=ServerSetup">
+ <input type="hidden" name="action" value="ip">
+ <input type="hidden" name="token" value="{{token}}">
+ <table class="slx-table">
+ {{#ips}}
+ <tr>
+ <td>{{ip}}</td>
+ {{#default}}
+ <td>
+ <span class="btn btn-success btn-xs"><span class="glyphicon glyphicon-ok"></span> {{lang_active}}</span>
+ </td>
+ {{/default}}
+ {{^default}}
+ <td>
+ <button class="btn btn-primary btn-xs" name="ip" value="{{ip}}" {{disabled}}>
+ <span class="glyphicon glyphicon-flag"></span>
+ {{lang_set}}
+ </button>
+ </td>
+ {{/default}}
+ </tr>
+ {{/ips}}
+ </table>
+</form>
+<hr>
+
+<h3>
+ {{lang_recompileHead}}
+</h3>
+<p>
+ {{lang_recompileHint}}
+</p>
+{{#error}}
+<div class="alert alert-danger">{{error}}</div>
+{{/error}}
+<form method="post" action="?do=ServerSetup">
+ <input type="hidden" name="token" value="{{token}}">
+ <div class="form-group">
+ <label>
+ {{lang_versionSelect}}
+ <select class="form-control" name="version">
+ {{#versions}}
+ <option value="{{hash}}" {{hash_selected}}>{{date_s}} ({{hash_s}})</option>
+ {{/versions}}
+ </select>
+ </label>
</div>
- <div class="panel-body">
- <div class="{{chooseHintClass}}">
- {{lang_chooseIP}}
- </div>
- <form method="post" action="?do=ServerSetup">
- <input type="hidden" name="action" value="ip">
- <input type="hidden" name="token" value="{{token}}">
- <table class="slx-table">
- {{#ips}}
- <tr>
- <td>{{ip}}</td>
- {{#default}}
- <td>
- <span class="btn btn-success btn-xs"><span class="glyphicon glyphicon-ok"></span> {{lang_active}}</span>
- </td>
- {{/default}}
- {{^default}}
- <td>
- <button class="btn btn-primary btn-xs" name="ip" value="{{ip}}" {{disabled}}>
- <span class="glyphicon glyphicon-flag"></span>
- {{lang_set}}
- </button>
- </td>
- {{/default}}
- </tr>
- {{/ips}}
- </table>
- </form>
+ <div class="buttonbar">
+ <button class="btn btn-default" name="action" value="compile" {{disabled}}>
+ <span class="glyphicon glyphicon-refresh"></span>
+ {{lang_forceRecompile}}
+ </button>
+ <button class="btn btn-default" name="action" value="fetch" {{disabled}}>
+ <span class="glyphicon glyphicon-arrow-down"></span>
+ {{lang_fetchUpdate}}
+ </button>
+ <button class="btn btn-danger" name="action" value="reset" {{disabled}} data-confirm="{{lang_reallyGitReset}}">
+ <span class="glyphicon glyphicon-trash"></span>
+ {{lang_resetWorkingTree}}
+ </button>
</div>
- <div class="panel-body">
- <p>
- {{lang_recompileHint}}
- </p>
- <form method="post" action="?do=ServerSetup">
- <input type="hidden" name="token" value="{{token}}">
- <button class="btn btn-default" name="action" value="compile" {{disabled}}>
- <span class="glyphicon glyphicon-refresh"></span>
- {{lang_forceRecompile}}
- </button>
- </form>
- </div>
-</div> \ No newline at end of file
+</form>
+<hr>
+
+<h3>{{lang_lastBuild}}</h3>
+{{lastBuild}}
diff --git a/modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html b/modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html
index 344d3905..328b61f6 100644
--- a/modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html
+++ b/modules-available/serversetup-bwlp-ipxe/templates/ipxe_update.html
@@ -19,8 +19,9 @@
</div>
<script type="text/javascript">
+ var $slxFileList;
document.addEventListener('DOMContentLoaded', function() {
- var slxFileList = $('#file-list').find('.glyphicon');
+ $slxFileList = $('#file-list').find('.glyphicon');
});
function ipxeGenCb(task)
@@ -30,25 +31,26 @@
if (task.statusCode === 'TASK_FINISHED') {
$('#tm-compile-div').find('pre').hide();
+ window.location.href = '?do=serversetup&show=address&sv=0';
}
+ // Working or finished
+ if (task.data && task.data.files && task.data.files) {
+ for (var k in task.data.files) {
+ if (!task.data.files[k])
+ continue;
+ var f = '#built-' + k.replace('/', '-').replace('.', '-');
+ var $e = $(f);
+ $e.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-ok text-success');
+ }
+ }
+ // On failure, change non-built targets to X
if (task.statusCode === 'TASK_ERROR') {
var $gf = $('#genfailed');
if (task.data && task.data.errors) {
$gf.append($('<pre>').text(task.data.errors));
}
$gf.show('slow');
- slxFileList.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-stop');
- } else {
- // Working or finished
- if (task.data && task.data.files && task.data.files) {
- for (var k in task.data.files) {
- if (!task.data.files[k])
- continue;
- var f = '#built-' + k.replace('/', '-').replace('.', '-');
- var $e = $(f);
- $e.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-ok text-success');
- }
- }
+ $slxFileList.find('.glyphicon-question-sign').removeClass('glyphicon-question-sign').addClass('glyphicon-stop');
}
}
</script>