From d957c1b2fcb2caf1920fa200c9d17863e1326ad5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 7 Mar 2019 18:37:12 +0100 Subject: [serversetup-bwlp-ipxe] Improve legacy PXELinux import --- .../serversetup-bwlp-ipxe/inc/ipxe.inc.php | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php') diff --git a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php index 4320bb82..4683c843 100644 --- a/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php +++ b/modules-available/serversetup-bwlp-ipxe/inc/ipxe.inc.php @@ -207,7 +207,7 @@ class IPxe 'isdefault' => $isDefault, ]); $menuId = Database::lastInsertId(); - if (!array_key_exists($defaultLabel, $menuEntries) && $timeoutMs > 0) { + if (($defaultLabel === false || !array_key_exists($defaultLabel, $menuEntries)) && $timeoutMs > 0) { $defaultLabel = array_keys($menuEntries)[0]; } // Link boot entries to menu @@ -236,7 +236,10 @@ class IPxe if ($entry instanceof PxeSection) { $data['hidden'] = (int)$entry->isHidden; // Prefer explicit data from this imported menu over the defaults - $data['title'] = self::sanitizeIpxeString($entry->title); + $title = self::sanitizeIpxeString($entry->title); + if (!empty($title)) { + $data['title'] = $title; + } if (MenuEntry::getKeyCode($entry->hotkey) !== false) { $data['hotkey'] = $entry->hotkey; } @@ -266,22 +269,28 @@ class IPxe private static function createDefaultEntries() { - $query = 'INSERT IGNORE INTO serversetup_bootentry (entryid, hotkey, title, builtin, data) - VALUES (:entryid, :hotkey, :title, 1, :data)'; - Database::exec($query, + Database::exec( 'INSERT IGNORE INTO serversetup_bootentry (entryid, hotkey, title, builtin, data) + VALUES (:entryid, :hotkey, :title, 1, :data)', [ - 'script' => ' + 'entryid' => 'bwlp-default', + 'hotkey' => 'B', + 'title' => 'bwLehrpool-Umgebung starten', + 'data' => json_encode([ + 'script' => ' imgfree || set slxextra ,logo || initrd /boot/default/initramfs-stage31 || goto fail initrd --name logo /tftp/bwlp.ppm.gz /etc/splash.ppm.gz || clear slxextra boot -a -r /boot/default/kernel initrd=initramfs-stage31${slxextra} slxbase=boot/default quiet splash loglevel=5 rd.systemd.show_status=auto intel_iommu=igfx_off ${ipappend1} ${ipappend2} || goto fail ', + ]), ]); + $query = 'INSERT IGNORE INTO serversetup_bootentry (entryid, hotkey, title, builtin, data) + VALUES (:entryid, :hotkey, :title, 1, :data)'; Database::exec($query, [ 'entryid' => 'bwlp-default-dbg', - 'hotkey' => '', + 'hotkey' => 'D', 'title' => 'bwLehrpool-Umgebung starten (nosplash, debug)', 'data' => json_encode([ 'executable' => '/boot/default/kernel', -- cgit v1.2.3-55-g7522