$v) { $query .= $k . '=' . $v . '&'; } //$query = substr($query, 0, -1); echo <<itemCount() === 1 && $menu->timeoutMs() === 0 && ($tmp = $menu->getDefaultScriptLabel()) !== false) { $directBoot = "goto $tmp ||"; $initLabel = 'init'; } else { $directBoot = ''; } // Get preferred localboot method, depending on system model $localboot = false; $model = false; if ($uuid !== false && Module::get('statistics') !== false) { // If we have the machine table, we rather try to look up the system model from there, using the UUID $row = Database::queryFirst('SELECT systemmodel FROM machine WHERE machineuuid = :uuid', ['uuid' => $uuid]); if ($row !== false && !empty($row['systemmodel'])) { $model = $row['systemmodel']; } } if ($model === false) { // Otherwise use what iPXE sent us function modfilt($str) { if (empty($str) || preg_match('/product\s+name|be\s+filled|unknown|default\s+string|system\s+model|manufacturer/i', $str)) return false; return trim(preg_replace('/\s+/', ' ', $str)); } $manuf = modfilt($manuf); $product = modfilt($product); if (!empty($product)) { $model = $product; if (!empty($manuf)) { $model .= " ($manuf)"; } } } // Query if ($model !== false) { $e = strtolower($platform); // We made sure $platform is either PCBIOS or EFI, so no injection possible $row = Database::queryFirst("SELECT $e AS bootmethod FROM serversetup_localboot WHERE systemmodel = :model LIMIT 1", ['model' => $model]); if ($row !== false) { $localboot = $row['bootmethod']; } } if ($localboot === false || !isset($BOOT_METHODS[$localboot])) { $localboot = Localboot::getDefault()[$platform]; if (!isset($BOOT_METHODS[$localboot])) { $localboot = array_keys($BOOT_METHODS)[0]; } } // Convert to actual ipxe code if (isset($BOOT_METHODS[$localboot])) { $localboot = $BOOT_METHODS[$localboot]; } else { $localboot = 'prompt Localboot not possible'; } if ($slxExtensions) { $slxConsoleUpdate = '--update'; $slxPasswordOnly = '--nouser'; } else { $slxConsoleUpdate = ''; $slxPasswordOnly = ''; } $output = <<getMenuDefinition('target', $platform, $slxExtensions); $output .= <<getItemsCode($platform); /* :i5 chain -a /tftp/memtest.0 passes=1 onepass || goto membad prompt Memory OK. Press a key. goto init :i8 set x:int32 0 :again console --left 60 --top 130 --right 67 --bottom 96 --picture bg-load --keep || console --left 55 --top 88 --right 63 --bottom 64 --picture bg-menu --keep || inc x iseq \${x} 20 || goto again prompt DONE. Press dein Knie. goto slx_menu :membad iseq \${errno} 0x1 || goto memaborted params param scrot \${vram} imgfetch -a http://132.230.8.113/screen.php##params || prompt Memory is bad. Press a key. goto init :memaborted params param scrot \${vram} imgfetch -a http://132.230.8.113/screen.php##params || prompt Memory test aborted. Press a key. goto init */ $output .= <<