From c21ffba60dc2c08efbe44220cacf14bd31ef9885 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 2 Nov 2023 17:27:48 +0100 Subject: [serversetup-pxelinux] Delete module Unmaintained and untested for years now --- .../serversetup-bwlp-pxelinux/config.json | 3 - .../hooks/ipxe-update.inc.php | 9 - .../hooks/main-warning.inc.php | 6 - .../lang/de/messages.json | 5 - .../serversetup-bwlp-pxelinux/lang/de/module.json | 4 - .../lang/de/permissions.json | 6 - .../lang/de/template-tags.json | 33 ---- .../lang/en/messages.json | 5 - .../serversetup-bwlp-pxelinux/lang/en/module.json | 3 - .../lang/en/permissions.json | 6 - .../lang/en/template-tags.json | 33 ---- .../lang/pt/messages.json | 3 - .../serversetup-bwlp-pxelinux/lang/pt/module.json | 3 - .../lang/pt/template-tags.json | 38 ----- .../serversetup-bwlp-pxelinux/page.inc.php | 187 --------------------- .../permissions/permissions.json | 14 -- .../templates/heading.html | 1 - .../templates/ipaddress.html | 37 ---- .../serversetup-bwlp-pxelinux/templates/ipxe.html | 117 ------------- .../templates/ipxe_update.html | 38 ----- 20 files changed, 551 deletions(-) delete mode 100644 modules-available/serversetup-bwlp-pxelinux/config.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/hooks/ipxe-update.inc.php delete mode 100644 modules-available/serversetup-bwlp-pxelinux/hooks/main-warning.inc.php delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/de/messages.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/de/module.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/de/permissions.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/de/template-tags.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/en/messages.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/en/module.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/en/permissions.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/en/template-tags.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/pt/messages.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/pt/module.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/lang/pt/template-tags.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/page.inc.php delete mode 100644 modules-available/serversetup-bwlp-pxelinux/permissions/permissions.json delete mode 100644 modules-available/serversetup-bwlp-pxelinux/templates/heading.html delete mode 100644 modules-available/serversetup-bwlp-pxelinux/templates/ipaddress.html delete mode 100644 modules-available/serversetup-bwlp-pxelinux/templates/ipxe.html delete mode 100644 modules-available/serversetup-bwlp-pxelinux/templates/ipxe_update.html diff --git a/modules-available/serversetup-bwlp-pxelinux/config.json b/modules-available/serversetup-bwlp-pxelinux/config.json deleted file mode 100644 index 36268c6a..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "category": "main.settings-server" -} \ No newline at end of file diff --git a/modules-available/serversetup-bwlp-pxelinux/hooks/ipxe-update.inc.php b/modules-available/serversetup-bwlp-pxelinux/hooks/ipxe-update.inc.php deleted file mode 100644 index baa7a1bf..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/hooks/ipxe-update.inc.php +++ /dev/null @@ -1,9 +0,0 @@ -handleGetImage(); - } - - $this->currentMenu = Property::getBootMenu(); - - $action = Request::post('action'); - - if ($action === false) { - $this->currentAddress = Property::getServerIp(); - $this->getLocalAddresses(); - } - - if ($action === 'ip') { - User::assertPermission("edit.address"); - // New address is to be set - $this->getLocalAddresses(); - $this->updateLocalAddress(); - } - - if ($action === 'ipxe') { - User::assertPermission("edit.menu"); - // iPXE stuff changes - $this->updatePxeMenu(); - } - - if (Request::isPost()) { - Util::redirect('?do=serversetup'); - } - - User::assertPermission('access-page'); - } - - protected function doRender() - { - Render::addTemplate("heading"); - $task = Property::get('ipxe-task-id'); - if ($task !== false) { - $task = Taskmanager::status($task); - if (!Taskmanager::isTask($task) || Taskmanager::isFinished($task)) { - $task = false; - } - } - if ($task !== false) { - Render::addTemplate('ipxe_update', array('taskid' => $task['id'])); - } - - Permission::addGlobalTags($perms, null, ['edit.menu', 'edit.address', 'download']); - - Render::addTemplate('ipaddress', array( - 'ips' => $this->taskStatus['data']['addresses'], - 'chooseHintClass' => $this->hasIpSet ? '' : 'alert alert-danger', - 'editAllowed' => User::hasPermission("edit.address"), - 'perms' => $perms, - )); - $data = $this->currentMenu; - if (!User::hasPermission('edit.menu')) { - unset($data['masterpasswordclear']); - } - if (!isset($data['defaultentry'])) { - $data['defaultentry'] = 'net'; - } - if ($data['defaultentry'] === 'net') { - $data['active-net'] = 'checked'; - } - if ($data['defaultentry'] === 'hdd') { - $data['active-hdd'] = 'checked'; - } - if ($data['defaultentry'] === 'custom') { - $data['active-custom'] = 'checked'; - } - $data['perms'] = $perms; - Render::addTemplate('ipxe', $data); - } - - // ----------------------------------------------------------------------------------------------- - - private function getLocalAddresses() - { - $this->taskStatus = Taskmanager::submit('LocalAddressesList', array()); - - if ($this->taskStatus === false) { - $this->taskStatus['data']['addresses'] = false; - return false; - } - - if (!Taskmanager::isFinished($this->taskStatus)) { // TODO: Async if just displaying - $this->taskStatus = Taskmanager::waitComplete($this->taskStatus['id'], 4000); - } - - if (Taskmanager::isFailed($this->taskStatus) || !isset($this->taskStatus['data']['addresses'])) { - $this->taskStatus['data']['addresses'] = false; - return false; - } - - $sortIp = array(); - foreach (array_keys($this->taskStatus['data']['addresses']) as $key) { - $item = & $this->taskStatus['data']['addresses'][$key]; - if (!isset($item['ip']) || !preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $item['ip']) || substr($item['ip'], 0, 4) === '127.') { - unset($this->taskStatus['data']['addresses'][$key]); - continue; - } - if ($this->currentAddress === $item['ip']) { - $item['default'] = true; - $this->hasIpSet = true; - } - $sortIp[] = $item['ip']; - } - unset($item); - array_multisort($sortIp, SORT_STRING, $this->taskStatus['data']['addresses']); - return true; - } - - private function updateLocalAddress() - { - $newAddress = Request::post('ip', 'none'); - $valid = false; - foreach ($this->taskStatus['data']['addresses'] as $item) { - if ($item['ip'] !== $newAddress) - continue; - $valid = true; - break; - } - if ($valid) { - Property::setServerIp($newAddress); - Util::redirect('?do=ServerSetup'); - } else { - Message::addError('invalid-ip', $newAddress); - } - Util::redirect(); - } - - private function updatePxeMenu() - { - $timeout = Request::post('timeout', 10); - if ($timeout === '') - $timeout = 0; - if (!is_numeric($timeout) || $timeout < 0) { - Message::addError('main.value-invalid', 'timeout', $timeout); - } - $this->currentMenu['defaultentry'] = Request::post('defaultentry', 'net'); - $this->currentMenu['timeout'] = $timeout; - $this->currentMenu['custom'] = Request::post('custom', ''); - $this->currentMenu['masterpasswordclear'] = Request::post('masterpassword', ''); - if (empty($this->currentMenu['masterpasswordclear'])) - $this->currentMenu['masterpassword'] = 'invalid'; - else - $this->currentMenu['masterpassword'] = Crypto::hash6($this->currentMenu['masterpasswordclear']); - Property::setBootMenu($this->currentMenu); - Trigger::ipxe(); - Util::redirect('?do=ServerSetup'); - } - - private function handleGetImage() - { - $file = "/opt/openslx/ipxe/openslx-bootstick.raw"; - if (!is_readable($file)) { - Message::addError('image-not-found'); - return; - } - Header('Content-Type: application/octet-stream'); - Header('Content-Disposition: attachment; filename="openslx-bootstick-' . Property::getServerIp() . '-raw.img"'); - readfile($file); - exit; - } - -} diff --git a/modules-available/serversetup-bwlp-pxelinux/permissions/permissions.json b/modules-available/serversetup-bwlp-pxelinux/permissions/permissions.json deleted file mode 100644 index 44927506..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/permissions/permissions.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "access-page": { - "location-aware": false - }, - "download": { - "location-aware": false - }, - "edit.address": { - "location-aware": false - }, - "edit.menu": { - "location-aware": false - } -} \ No newline at end of file diff --git a/modules-available/serversetup-bwlp-pxelinux/templates/heading.html b/modules-available/serversetup-bwlp-pxelinux/templates/heading.html deleted file mode 100644 index d68360f1..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/templates/heading.html +++ /dev/null @@ -1 +0,0 @@ -

{{lang_moduleHeading}}

\ No newline at end of file diff --git a/modules-available/serversetup-bwlp-pxelinux/templates/ipaddress.html b/modules-available/serversetup-bwlp-pxelinux/templates/ipaddress.html deleted file mode 100644 index 8d73dfac..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/templates/ipaddress.html +++ /dev/null @@ -1,37 +0,0 @@ -
-
- {{lang_bootAddress}} -
-
-
- {{lang_chooseIP}} -
-
- - - - {{#ips}} - - - {{#default}} - - {{/default}} - {{^default}} - - {{/default}} - - {{/ips}} -
{{ip}} - {{lang_active}} - - -
-

- {{lang_bootHint}} -

-
-
-
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp-pxelinux/templates/ipxe.html b/modules-available/serversetup-bwlp-pxelinux/templates/ipxe.html deleted file mode 100644 index f4b0b4d3..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/templates/ipxe.html +++ /dev/null @@ -1,117 +0,0 @@ -
- - - - -
-
- {{lang_bootMenu}} -
-
-

- {{lang_bootInfo}} -

-
- -
- {{lang_bootBehavior}} -
- - -
-
- - -
-
- - -
-
- -
- {{lang_menuDisplayTime}} -
- - {{lang_seconds}} -
-
- -
- {{lang_masterPassword}} -
- -
- {{lang_masterPasswordHelp}} -
- -
- {{lang_menuCustom}} - -
-
- - -
-
- - - - \ No newline at end of file diff --git a/modules-available/serversetup-bwlp-pxelinux/templates/ipxe_update.html b/modules-available/serversetup-bwlp-pxelinux/templates/ipxe_update.html deleted file mode 100644 index c5aafa1c..00000000 --- a/modules-available/serversetup-bwlp-pxelinux/templates/ipxe_update.html +++ /dev/null @@ -1,38 +0,0 @@ -
-
{{lang_menuGeneration}}
-
- - -
-
- {{lang_generationFailed}} -
-
-
{{lang_menuGeneration}}
-
-
- - -- cgit v1.2.3-55-g7522