JackBootHTTP/html/ipxe/iscsi-boot.php

31 lines
691 B
PHP
Raw Normal View History

2022-07-24 19:59:02 +01:00
<?php
header("Content-Type: text/plain");
$config = json_decode(file_get_contents("/config/config.json"), true);
$menuOptions = "";
$gotoSections = "";
foreach($config["iscsi-targets"] as $target) {
$id = uniqid();
$menuOptions .= "item {$id} {$target['name']}\r\n";
$gotoSections .= ":{$id}\r\n";
$gotoSections .= "sanboot {$target['target']}\r\n";
$gotoSections .= "goto back\r\n";
};
$template = "#!ipxe
menu Select an iSCSI target to boot from
item --gap -- iSCSI targets
{$menuOptions}
item
item back Back to main menu
choose selected
goto \${selected} || goto shell
{$gotoSections}
:back
chain http://{$config['host']}/ipxe/main-menu.php";
print($template);