From 1419f851e2870fd5c13bb6ee30305f19d049d01b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 20 Sep 2018 17:08:41 +0200 Subject: [serversetup-bwlp] Implement chain-to-self for missing params --- modules-available/serversetup-bwlp/api.inc.php | 94 ++++++++++------------ .../templates/ipxe-new-boot-entry.html | 6 ++ 2 files changed, 49 insertions(+), 51 deletions(-) (limited to 'modules-available') diff --git a/modules-available/serversetup-bwlp/api.inc.php b/modules-available/serversetup-bwlp/api.inc.php index 52f30440..bc81d35d 100644 --- a/modules-available/serversetup-bwlp/api.inc.php +++ b/modules-available/serversetup-bwlp/api.inc.php @@ -1,6 +1,44 @@ $v) { + $query .= $k . '=' . $v . '&'; + } + $query = substr($query, 0, -1); + echo << 'exit 1', @@ -14,11 +52,8 @@ $ip = $_SERVER['REMOTE_ADDR']; if (substr($ip, 0, 7) === '::ffff:') { $ip = substr($ip, 7); } -$uuid = Request::any('uuid', false, 'string'); $menu = IPxeMenu::forClient($ip, $uuid); -// Get platform - EFI or PCBIOS -$platform = strtoupper(Request::any('platform', 'PCBIOS', 'string')); // Get preferred localboot method, depending on system model $localboot = false; @@ -38,8 +73,8 @@ if ($model === false) { return false; return trim(preg_replace('/\s+/', ' ', $str)); } - $manuf = modfilt(Request::any('manuf', false, 'string')); - $product = modfilt(Request::any('product', false, 'string')); + $manuf = modfilt($manuf); + $product = modfilt($product); if (!empty($product)) { $model = $product; if (!empty($manuf)) { @@ -114,17 +149,13 @@ goto fail # start :init -iseq \${nic} \${} && set nic 0 || - -set ipappend1 ip=\${net\${nic}/ip}:{$serverIp}:\${net\${nic}/gateway}:\${net\${nic}/netmask} -set ipappend2 BOOTIF=01-\${net\${nic}/mac:hexhyp} +set ipappend1 ip=\${ip}:{$serverIp}:\${gateway}:\${netmask} +set ipappend2 BOOTIF=01-\${mac:hexhyp} set serverip $serverIp || # Clean up in case we've been chained to imgfree || -ifopen || - imgfetch --name bg-load /tftp/openslx.png || imgfetch --name bg-menu /tftp/pxe-menu.png || @@ -162,41 +193,12 @@ $output .= $menu->getItemsCode($platform); // TODO: Work out memtest stuff. Needs to be put on server (install/update script) -- PCBIOS only? Chain EFI -> BIOS? /* -:i1 -#console || -echo Welcome to Shell || -shell -goto slx_menu - -:i2 -imgfree || -kernel /boot/default/kernel slxbase=boot/default slxsrv=$serverIp splash BOOTIF=01-\${net\${nic}/mac:hexhyp} || echo Could not download kernel -initrd /boot/default/initramfs-stage31 || echo Could not download initrd -boot -ar || goto fail - -:i3 -chain -ar \${self} || -chain -ar /tftp/undionly.kpxe || goto fail - -:i4 -imgfree || -sanboot --no-describe --drive 0x80 || goto fail :i5 chain -a /tftp/memtest.0 passes=1 onepass || goto membad prompt Memory OK. Press a key. goto init -:i6 -console --left 60 --top 130 --right 67 --bottom 96 --quick --picture bg-load --keep || -echo Welcome to Shell || -shell -goto slx_menu - -:i7 -chain -ar tftp://132.230.4.6/ipxelinux.0 || prompt FAILED PRESS A KEY -goto slx_menu - :i8 set x:int32 0 :again @@ -207,16 +209,6 @@ iseq \${x} 20 || goto again prompt DONE. Press dein Knie. goto slx_menu -:i9 -reboot || -prompt Reboot failed. Press a key. -goto slx_menu - -:i10 -poweroff || -prompt Poweroff failed. Press a key. -goto slx_menu - :membad iseq \${errno} 0x1 || goto memaborted params diff --git a/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html b/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html index 33de1ee4..95802f7a 100644 --- a/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html +++ b/modules-available/serversetup-bwlp/templates/ipxe-new-boot-entry.html @@ -115,6 +115,12 @@ + {{#builtin}} +
+ {{lang_editBuiltinWarn}} +
+ {{/builtin}} +