summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp-ipxe/api.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2024-02-23 17:02:05 +0100
committerSimon Rettberg2024-02-23 17:02:05 +0100
commitb476a91b5851767748d241af754cdfc782552d4d (patch)
tree4c9616b37210d13d7464dfeca6b3f4cd24fbb62a /modules-available/serversetup-bwlp-ipxe/api.inc.php
parent[minilinux] Harmonize wording some more :) (diff)
downloadslx-admin-b476a91b5851767748d241af754cdfc782552d4d.tar.gz
slx-admin-b476a91b5851767748d241af754cdfc782552d4d.tar.xz
slx-admin-b476a91b5851767748d241af754cdfc782552d4d.zip
[serversetup-bwlp-ipxe] Add initial support for GRUB menus
Diffstat (limited to 'modules-available/serversetup-bwlp-ipxe/api.inc.php')
-rw-r--r--modules-available/serversetup-bwlp-ipxe/api.inc.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules-available/serversetup-bwlp-ipxe/api.inc.php b/modules-available/serversetup-bwlp-ipxe/api.inc.php
index 4ca9fdec..dc78f481 100644
--- a/modules-available/serversetup-bwlp-ipxe/api.inc.php
+++ b/modules-available/serversetup-bwlp-ipxe/api.inc.php
@@ -1,9 +1,20 @@
<?php
(function() {
- $type = Request::any('type');
+ $type = Request::any('type', null, 'string');
+ if ($type === null && isset($_SERVER['HTTP_USER_AGENT'])) {
+ if (preg_match('/^iPXE/', $_SERVER['HTTP_USER_AGENT'])) {
+ $type = 'ipxe';
+ } elseif (preg_match('/^GRUB/', $_SERVER['HTTP_USER_AGENT'])) {
+ $type = 'grub';
+ } elseif (preg_match('/wget|curl/i', $_SERVER['HTTP_USER_AGENT'])) {
+ $type = 'bash';
+ }
+ }
if ($type === 'bash') {
$builder = new ScriptBuilderBash();
+ } elseif ($type === 'grub') {
+ $builder = new ScriptBuilderGrub();
} else {
$builder = new ScriptBuilderIpxe();
}