From 639715cee0744fd1b5f5ded28b1b60c969702026 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 21 Nov 2013 17:02:04 +0100 Subject: Make default boot entry selectable (also fix menu timeout) --- apis/exec.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apis') diff --git a/apis/exec.inc.php b/apis/exec.inc.php index 749ca86a..60ca679f 100644 --- a/apis/exec.inc.php +++ b/apis/exec.inc.php @@ -47,6 +47,8 @@ switch ($type) { case 'ipxe': if (!isset($_REQUEST['ip'])) die('No IP given'); $ip = preg_replace('/[^0-9\.]/', '', $_REQUEST['ip']); + $default = $_REQUEST['default']; + if (!preg_match('/openslx|hddboot/', $default)) $default = 'openslx'; $command = '/opt/openslx/build_ipxe.sh "' . CONFIG_IPXE_DIR . '/last-ip" "' . $ip . '"'; $conf = Render::parse('txt-ipxeconfig', array( 'SERVER' => $ip @@ -54,7 +56,8 @@ case 'ipxe': if (false === file_put_contents('/opt/openslx/ipxe/ipxelinux.ipxe', $conf)) die('Error writing iPXE Config'); $conf = Render::parse('txt-pxeconfig', array( 'SERVER' => $ip, - 'DEFAULT' => 'openslx' + 'DEFAULT' => $default, + $default => 'MENU DEFAULT' )); if (false === file_put_contents(CONFIG_TFTP_DIR . '/pxelinux.cfg/default', $conf)) die('Error writing PXE Menu'); Database::exec("INSERT IGNORE INTO setting_global (setting, value) VALUES ('SLX_VM_NFS', :value)", array(':value' => "$ip:/srv/openslx/nfs")); -- cgit v1.2.3-55-g7522