127 parent::__construct();
128 $grubChain =
'chain -ar ${boot-url}/service/ipxe/grub.exe '
129 .
'--config-file="%s"';
130 $sanboot =
'sanboot --no-describe --drive 0x80';
132 'imgfetch ${boot-url}/service/ipxe/refind.conf%s'
133 .
'chain -ar ${boot-url}/service/ipxe/refind_x64.efi',
137 if (stripos($_REQUEST[
'arch'],
'i386') !==
false) {
140 'imgfetch ${boot-url}/service/ipxe/refind.conf%s'
141 .
'chain -ar ${boot-url}/service/ipxe/refind_ia32.efi',
146 if (stripos($_REQUEST[
'arch'],
'arm') !==
false) {
148 $refind =
'chain -ar ${boot-url}/service/ipxe/refind_aa64.efi';
154 'rootnoverify (hd0);chainloader +1'
158 'cdrom --init;map --hook;root (cd0);chainloader (cd0)"'
162 'find --set-root /BOOTMGR;chainloader /BOOTMGR"'
165 self::$_exitTypes = array(
166 'sanboot' => $sanboot,
167 'grub' => $grub[
'basic'],
168 'grub_first_hdd' => $grub[
'basic'],
169 'grub_first_cdrom' => $grub[
'1cd'],
170 'grub_first_found_windows' => $grub[
'1fw'],
171 'refind_efi' => $refind,
192 $curroot = trim($curroot,
'/');
194 $this->_web = sprintf(
'%s://%s%s', self::$httpproto, $webserver, $webroot);
195 $Send[
'booturl'] = array(
197 "set fog-ip $webserver",
198 sprintf(
'set fog-webroot %s', basename($curroot)),
201 .
'://${fog-ip}/${fog-webroot}',
205 if (!
self::$Host->
get(
'inventory')->
get(
'sysuuid')) {
208 ->set(
'sysuuid', $_REQUEST[
'sysuuid'])
213 $host_field_test =
'biosexit';
214 $global_field_test =
'FOG_BOOT_EXIT_TYPE';
215 if ($_REQUEST[
'platform'] ==
'efi') {
216 $host_field_test =
'efiexit';
217 $global_field_test =
'FOG_EFI_BOOT_EXIT_TYPE';
219 $StorageNodeID = @min(
220 self::getSubObjectIDs(
229 $serviceNames = array(
230 'FOG_EFI_BOOT_EXIT_TYPE',
233 'FOG_KERNEL_LOGLEVEL',
234 'FOG_KERNEL_RAMDISK_SIZE',
237 'FOG_MEMTEST_KERNEL',
238 'FOG_PXE_BOOT_IMAGE',
239 'FOG_PXE_BOOT_IMAGE_32',
240 'FOG_PXE_HIDDENMENU_TIMEOUT',
241 'FOG_PXE_MENU_HIDDEN',
242 'FOG_PXE_MENU_TIMEOUT',
243 'FOG_TFTP_PXE_KERNEL',
244 'FOG_TFTP_PXE_KERNEL_32',
265 'name' => $serviceNames
274 $memdisk =
'memdisk';
275 $loglevel = $kernelLogLevel;
276 $ramsize = $kernelRamDisk;
278 $hiddenmenu > 0 && !$_REQUEST[
'menuAccess'] ?
283 $hiddenmenu > 0 && !$_REQUEST[
'menuAccess'] ?
287 if ($_REQUEST[
'arch'] !=
'x86_64') {
288 $bzImage = $bzImage32;
289 $imagefile = $init_32;
302 $StorageGroup = $StorageNode->getStorageGroup();
306 self::getSetting($global_field_test)
309 if (!$exit || !in_array($exit, array_keys(self::$_exitTypes))) {
312 $initrd = $imagefile;
314 self::$HookManager->processEvent(
315 'BOOT_ITEM_NEW_SETTINGS',
318 'StorageGroup' => &$StorageGroup,
319 'StorageNode' => &$StorageNode,
320 'webserver' => &$webserver,
321 'webroot' => &$webroot,
322 'memtest' => &$memtest,
323 'memdisk' => &$memdisk,
324 'bzImage' => &$bzImage,
325 'imagefile' => &$imagefile,
326 'initrd' => &$initrd,
327 'loglevel' => &$loglevel,
328 'ramsize' => &$ramsize,
329 'keymap' => &$keymap,
330 'timeout' => &$timeout,
331 'keySequence' => &$keySequence,
336 $initrd = $imagefile;
337 $this->_timeout = $timeout;
338 $this->_hiddenmenu = ($hiddenmenu && !$_REQUEST[
'menuAccess']);
339 $this->_bootexittype = self::$_exitTypes[$exit];
340 $this->_loglevel =
"loglevel=$loglevel";
342 $this->_booturl = self::$httpproto
343 .
"://{$webserver}/fog/service";
344 $this->_memdisk =
"kernel $memdisk initrd=$memtest";
345 $this->_memtest =
"initrd $memtest";
346 $StorageNodes = (array)self::getClass(
'StorageNodeManager')
351 self::resolveHostname($webserver)
355 if (count($StorageNodes) < 1) {
356 $StorageNodes = (array)self::getClass(
'StorageNodeManager')
358 foreach ($StorageNodes as $StorageNode) {
360 if ($hostname == $webserver
361 || $hostname == self::resolveHostname($webserver)
367 if (!$StorageNode->isValid()) {
368 $storageNodeIDs = (array)self::getSubObjectIDs(
370 array(
'isMaster' => 1)
372 if (count($storageNodeIDs) < 1) {
373 $storageNodeIDs = (array)self::getSubObjectIDs(
377 $StorageNode =
new StorageNode(@min($storageNodeIDs));
380 $StorageNode = current($StorageNodes);
382 if ($StorageNode->isValid()) {
383 $this->_storage = sprintf(
384 'storage=%s:/%s/ storageip=%s',
385 trim($StorageNode->get(
'ip')),
386 trim($StorageNode->get(
'path'),
'/'),
387 trim($StorageNode->get(
'ip'))
390 $this->_kernel = sprintf(
391 'kernel %s %s initrd=%s root=/dev/ram0 rw '
392 .
'ramdisk_size=%s%sweb=%s consoleblank=0%s rootfstype=ext4%s%s '
393 .
'%s nvme_core.default_ps_max_latency_us=0',
398 strlen($keymap) ? sprintf(
' keymap=%s ', $keymap) :
' ',
400 $kernelDebug ?
' debug' :
' ',
401 $kernelArgs ? sprintf(
' %s', $kernelArgs) :
'',
409 $this->_initrd =
"imgfetch $imagefile";
411 ->processEvent(
'BOOT_MENU_ITEM');
413 self::getSubObjectIDs(
422 $defaultMenu->isValid() ?
423 trim($defaultMenu->get(
'name')) :
430 $this->_defaultChoice
437 self::$HookManager->processEvent(
438 'ALTERNATE_BOOT_CHECKS'
440 if (isset($_REQUEST[
'username'])) {
442 } elseif ($_REQUEST[
'delconf']) {
444 } elseif ($_REQUEST[
'key']) {
446 } elseif ($_REQUEST[
'sessname']) {
448 } elseif ($_REQUEST[
'aprvconf']) {
468 'choose --default %s --timeout %s target && goto ${target}',
480 $filename = trim(basename($_REQUEST[
'filename']));
481 $product = trim($_REQUEST[
'product']);
482 $manufacturer = trim($_REQUEST[
'manufacturer']);
484 'file' => sprintf(
'%s', $filename ? $filename :
''),
485 'product' => sprintf(
'%s', $product ? $product :
''),
486 'manufacturer' => sprintf(
'%s', $manufacturer ? $manufacturer :
''),
493 $id = @max(self::getSubObjectIDs(
'iPXE', $findWhere));
495 ->set(
'product', $findWhere[
'product'])
496 ->set(
'manufacturer', $findWhere[
'manufacturer'])
497 ->set(
'mac', $findWhere[
'mac'])
500 ->set(
'file', $findWhere[
'file'])
501 ->set(
'version', trim($_REQUEST[
'ipxever']))
515 if (!$this->_hiddenmenu || $shortCircuit) {
516 $Send[
'chainnohide'] = array(
517 'cpuid --ext 29 && set arch x86_64 || set arch i386',
519 'param mac0 ${net0/mac}',
520 'param arch ${arch}',
521 'param platform ${platform}',
522 'param menuAccess 1',
523 "param debug $debug",
524 'param sysuuid ${uuid}',
525 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
526 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
528 "chain -ar $this->_booturl/ipxe/boot.php##params",
532 $this->_KS->isValid() ?
533 trim($this->_KS->get(
'ascii')) :
537 $this->_KS->isValid() ?
538 trim($this->_KS->get(
'name')) :
541 $Send[
'chainhide'] = array(
542 'cpuid --ext 29 && set arch x86_64 || set arch i386',
543 "iseq \${platform} efi && set key 0x1b || set key $KSKey",
544 "iseq \${platform} efi && set keyName ESC || "
545 .
"set keyName $KSName",
546 "prompt --key \${key} --timeout $this->_timeout "
547 .
"Booting... (Press \${keyName} to access the menu) && "
548 .
"goto menuAccess || $this->_bootexittype",
552 'param mac0 ${net0/mac}',
553 'param arch ${arch}',
554 'param platform ${platform}',
555 'param username ${username}',
556 'param password ${password}',
557 'param menuaccess 1',
558 "param debug $debug",
559 'param sysuuid ${uuid}',
560 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
561 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
563 "chain -ar $this->_booturl/ipxe/boot.php##params",
576 $Send[
'delsuccess'] = array(
577 'echo Host deleted successfully',
581 $Send[
'delfail'] = array(
582 'echo Failed to destroy Host!',
596 $Send[
'ignored'] = array(
597 'echo The MAC Address is set to be ignored for imaging tasks',
611 $Send[
'approvesuccess'] = array(
612 'echo Host approved successfully',
617 $_REQUEST[
'extraargs']
619 $isdebug = preg_match(
620 '#isdebug=yes|mode=debug|mode=onlydebug#i',
621 $_REQUEST[
'extraargs']
630 $_REQUEST[
'username']
633 $Send[
'approvefail'] = array(
634 'echo Host approval failed',
650 $kernelArgs = array();
651 foreach ((array)$kernelArgsArray as &$arg) {
655 if (is_array($arg)) {
656 if (!(isset($arg[
'value']) && $arg[
'value'])) {
659 if (!(isset($arg[
'active']) && $arg[
'active'])) {
662 $kernelArgs[] = preg_replace(
663 '#mode=debug|mode=onlydebug#i',
668 $kernelArgs[] = preg_replace(
669 '#mode=debug|mode=onlydebug#i',
676 $kernelArgs = array_filter($kernelArgs);
677 $kernelArgs = array_unique($kernelArgs);
678 $kernelArgs = array_values($kernelArgs);
679 $kernelArgs = implode(
' ', (array)$kernelArgs);
685 "$this->_kernel $kernelArgs",
698 $Send[
'delconfirm'] = array(
699 'cpuid --ext 29 && set arch x86_64 || set arch i386',
700 'prompt --key y Would you like to delete this host? (y/N): &&',
702 'param mac0 ${net0/mac}',
703 'param arch ${arch}',
704 'param platform ${platform}',
706 'param sysuuid ${uuid}',
707 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
708 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
710 "chain -ar $this->_booturl/ipxe/boot.php##params",
721 $Send[
'aprvconfirm'] = array(
722 'cpuid --ext 29 && set arch x86_64 || set arch i386',
723 'prompt --key y Would you like to approve this host? (y/N): &&',
725 'param mac0 ${net0/mac}',
726 'param arch ${arch}',
727 'param platform ${platform}',
729 'param sysuuid ${uuid}',
730 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
731 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
733 "chain -ar $this->_booturl/ipxe/boot.php##params",
744 $Send[
'keyreg'] = array(
745 'cpuid --ext 29 && set arch x86_64 || set arch i386',
746 'echo -n Please enter the product key : ',
749 'param mac0 ${net0/mac}',
750 'param arch ${arch}',
751 'param platform ${platform}',
753 'param sysuuid ${uuid}',
754 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
755 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
757 "chain -ar $this->_booturl/ipxe/boot.php##params",
770 'name' => trim($_REQUEST[
'sessname']),
771 'stateID' => self::fastmerge(
772 self::getQueuedStates(),
773 (array)self::getProgressState()
776 foreach ((array)self::getClass(
'MulticastSessionManager')
777 ->find($findWhere) as &$MulticastSession
779 if (!$MulticastSession->isValid()
780 || $MulticastSession->get(
'sessclients') < 1
782 $MulticastSessionID = 0;
783 unset($MulticastSession);
786 $MulticastSessionID = $MulticastSession->get(
'id');
787 unset($MulticastSession);
791 if (!$MulticastSession->isValid()) {
792 $Send[
'checksession'] = array(
793 'echo No session found with that name.',
796 'cpuid --ext 29 && set arch x86_64 || set arch i386',
798 'param mac0 ${net0/mac}',
799 'param arch ${arch}',
800 'param platform ${platform}',
801 'param sessionJoin 1',
802 'param sysuuid ${uuid}',
803 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
804 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
806 "chain -ar $this->_booturl/ipxe/boot.php##params",
811 $this->
multijoin($MulticastSession->get(
'id'));
820 $Send[
'joinsession'] = array(
821 'cpuid --ext 29 && set arch x86_64 || set arch i386',
822 'echo -n Please enter the session name to join > ',
825 'param mac0 ${net0/mac}',
826 'param arch ${arch}',
827 'param platform ${platform}',
828 'param sessname ${sessname}',
829 'param sysuuid ${uuid}',
830 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
831 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
833 "chain -ar $this->_booturl/ipxe/boot.php##params",
849 $this->_kernel = str_replace(
859 $serviceNames = array(
860 'FOG_DISABLE_CHKDSK',
863 'FOG_MULTICAST_RENDEZVOUS',
875 'name' => $serviceNames
884 $shutdown =
false !== stripos(
888 if (!$shutdown && isset($_REQUEST[
'extraargs'])) {
889 $shutdown =
false !== stripos(
891 $_REQUEST[
'extraargs']
894 $StorageGroup =
$Image->getStorageGroup();
895 $StorageNode = $StorageGroup->getOptimalStorageNode();
896 $osid =
$Image->get(
'osID');
897 $storage = escapeshellcmd(
900 trim($StorageNode->get(
'ip')),
901 trim($StorageNode->get(
'path'),
'/'),
905 $storageip = $StorageNode->get(
'ip');
906 $img = escapeshellcmd(
$Image->get(
'path'));
907 $imgFormat = (int)
$Image->get(
'format');
908 $imgType =
$Image->getImageType()->get(
'type');
909 $imgPartitionType =
$Image->getPartitionType();
910 $imgid =
$Image->get(
'id');
911 $chkdsk = $chkdsk == 1 ? 0 : 1;
912 $ftp = $StorageNode->get(
'ip');
913 $port = ($mc ? $mc->get(
'port') :
null);
914 $kernelArgsArray = array(
918 "storageip=$storageip",
924 "imgPartitionType=$imgPartitionType",
926 "imgFormat=$imgFormat",
928 'value' =>
'shutdown=1',
929 'active' => $shutdown
932 'value' =>
"mcastrdv=$mcastrdv",
933 'active' => !empty($mcastrdv)
936 'value' =>
"capone=1",
940 'value' =>
"port=$port mc=yes",
948 'value' =>
'fdrive='.$nondev,
963 $Send[
'ImageListing'] = array(
968 $defItem =
'choose target && goto ${target}';
972 $imgFind = array(
'isEnabled' => 1);
973 if (!self::getSetting(
'FOG_IMAGE_LIST_MENU')) {
979 $imgFind[
'id'] =
self::$Host->getImage()->get(
'id');
982 if ($imgFind ===
false) {
988 $Send[
'NoImages'] = array(
989 'echo Host is not valid, host has no image assigned, or'
990 .
' there are no images defined on the server.',
997 function (&
$Image) use (&$Send, &$defItem) {
1002 $Send[
'ImageListing'],
1018 'choose --default %s --timeout %d target && '
1020 $Image->get(
'path'),
1029 $Send[
'ImageListing'],
1030 'item return Return to menu'
1033 $Send[
'ImageListing'],
1037 function (&
$Image) use (&$Send) {
1038 if (!
$Image->isValid()) {
1054 'param mac0 ${net0/mac}',
1055 'param arch ${arch}',
1056 'param imageID ${imageID}',
1058 'param username ${username}',
1059 'param password ${password}',
1060 'param sysuuid ${uuid}',
1061 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
1062 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
1068 $Send[
'returnmenu'] = array(
1071 'param mac0 ${net0/mac}',
1072 'param arch ${arch}',
1073 'param sysuuid ${uuid}',
1074 'isset ${net1/mac} && param mac1 ${net1/mac} || goto bootme',
1075 'isset ${net2/mac} && param mac2 ${net2/mac} || goto bootme',
1077 $Send[
'bootmefunc'] = array(
1079 "chain -ar $this->_booturl/ipxe/boot.php##params",
1095 if (!$MultiSess->isValid()) {
1098 $msImage = $MultiSess->getImage()->get(
'id');
1105 if ($msImage != $h_Image) {
1107 ->set(
'imagename', $MultiSess->getImage())
1108 ->set(
'imageID', $msImage);
1111 $shutdown = stripos(
1113 $_REQUEST[
'extraargs']
1115 $isdebug = preg_match(
1116 '#isdebug=yes|mode=debug|mode=onlydebug#i',
1117 $_REQUEST[
'extraargs']
1122 $MultiSess->get(
'name'),
1127 $_REQUEST[
'username'],
1151 $Send[
'keychangesuccess'] = array(
1152 'echo Successfully changed key',
1167 self::$HookManager->processEvent(
1172 'kernel' => &$this->_kernel,
1173 'initrd' => &$this->_initrd,
1174 'booturl' => &$this->_booturl,
1175 'memdisk' => &$this->_memdisk,
1176 'memtest' => &$this->_memtest,
1177 'web' => &$this->_web,
1178 'defaultChoice' => &$this->_defaultChoice,
1179 'bootexittype' => &$this->_bootexittype,
1180 'storage' => &$this->_storage,
1181 'shutdown' => &$this->_shutdown,
1182 'path' => &$this->_path,
1183 'timeout' => &$this->_timeout,
1187 if (count($Send) > 0) {
1188 array_walk_recursive(
1190 function (&
$val, &$key) {
1191 printf(
'%s%s', implode(
"\n", (array)
$val),
"\n");
1204 $Send[
'advancedlogin'] = array(
1205 "chain -ar $this->_booturl/ipxe/advanced.php",
1216 $Send[
'debugaccess'] = array(
1217 "$this->_kernel isdebug=yes",
1234 'FOG_ADVANCED_MENU_LOGIN',
1249 $_REQUEST[
'username'],
1250 $_REQUEST[
'password']
1252 if ($tmpUser->isValid()) {
1254 ->processEvent(
'ALTERNATE_LOGIN_BOOT_MENU_PARAMS');
1255 if ($advLogin && $_REQUEST[
'advLog']) {
1258 if ($_REQUEST[
'delhost']) {
1260 } elseif ($_REQUEST[
'keyreg']) {
1262 } elseif ($_REQUEST[
'qihost']) {
1264 } elseif ($_REQUEST[
'sessionJoin']) {
1266 } elseif ($_REQUEST[
'approveHost']) {
1268 } elseif ($_REQUEST[
'menuaccess']) {
1269 unset($this->_hiddenmenu);
1271 } elseif ($_REQUEST[
'debugAccess']) {
1277 $Send[
'invalidlogin'] = array(
1278 "echo Invalid login!",
1296 $shutdown = stripos(
1298 $_REQUEST[
'extraargs']
1300 $isdebug = preg_match(
1301 '#isdebug=yes|mode=debug|mode=onlydebug#i',
1302 $_REQUEST[
'extraargs']
1309 $this->
falseTasking(
'', self::getClass(
'Image', $imgID));
1312 if (
self::$Host->getImage()->
get(
'id') != $imgID) {
1314 ->set(
'imageID', $imgID)
1315 ->set(
'imagename',
new Image($imgID));
1328 $_REQUEST[
'username']
1331 }
catch (Exception $e) {
1332 $Send[
'fail'] = array(
1334 sprintf(
'echo %s', $e->getMessage()),
1347 $Send[
'nomenu'] = array(
1348 "$this->_bootexittype",
1361 if (!
$Task->isValid() ||
$Task->isSnapinTasking()) {
1367 $this->_kernel = str_replace(
1376 self::getSubObjectIDs(
1377 'MulticastSessionAssociation',
1379 'taskID' =>
$Task->get(
'id')
1384 $MulticastSession = $MulticastSessionAssoc->getMulticastSession();
1385 if ($MulticastSession && $MulticastSession->isValid()) {
1386 self::$Host->set(
'imageID', $MulticastSession->get(
'image'));
1391 $StorageGroup =
null;
1392 $StorageNode =
null;
1393 self::$HookManager->processEvent(
1394 'BOOT_TASK_NEW_SETTINGS',
1397 'StorageNode' => &$StorageNode,
1398 'StorageGroup' => &$StorageGroup,
1402 if (!$StorageGroup || !$StorageGroup->isValid()) {
1403 $StorageGroup =
$Image->getStorageGroup();
1405 $getter =
'getOptimalStorageNode';
1406 if (
$Task->isCapture()
1409 $StorageGroup =
$Image->getPrimaryStorageGroup();
1410 $getter =
'getMasterStorageNode';
1413 $getter =
'getMasterStorageNode';
1415 if (!$StorageNode || !$StorageNode->isValid()) {
1416 $StorageNode = $StorageGroup->{$getter}();
1418 if (
$Task->get(
'storagenodeID') != $StorageNode->get(
'id')) {
1419 $Task->set(
'storagenodeID', $StorageNode->get(
'id'));
1421 if (
$Task->get(
'storagegroupID') != $StorageGroup->get(
'id')) {
1422 $Task->set(
'storagegroupID', $StorageGroup->get(
'id'));
1425 self::$HookManager->processEvent(
1426 'BOOT_TASK_NEW_SETTINGS',
1429 'StorageNode' => &$StorageNode,
1430 'StorageGroup' => &$StorageGroup,
1434 $osid = (int)
$Image->get(
'osID');
1439 $imgPartitionType =
'';
1440 $serviceNames = array(
1441 'FOG_CAPTUREIGNOREPAGEHIBER',
1442 'FOG_CAPTURERESIZEPCT',
1443 'FOG_CHANGE_HOSTNAME_EARLY',
1444 'FOG_DISABLE_CHKDSK',
1447 'FOG_MULTICAST_RENDEZVOUS',
1466 'name' => $serviceNames
1475 $shutdown =
false !== stripos(
1479 if (!$shutdown && isset($_REQUEST[
'extraargs'])) {
1480 $shutdown =
false !== stripos(
1482 $_REQUEST[
'extraargs']
1485 $globalPIGZ = $pigz;
1486 $PIGZ_COMP = $globalPIGZ;
1488 $ip = trim($StorageNode->get(
'ip'));
1495 throw new Exception(_(
'No valid storage nodes found'));
1497 $storage = escapeshellcmd(
1501 trim($StorageNode->get(
'path'),
'/'),
1510 $img = escapeshellcmd(
1518 $imgPartitionType =
$Image
1519 ->getPartitionType();
1522 $image_PIGZ =
$Image->get(
'compress');
1523 if (is_numeric($image_PIGZ) && $image_PIGZ > -1) {
1524 $PIGZ_COMP = $image_PIGZ;
1526 if (in_array($imgFormat, array(
'',
null,0,1,2,3,4))) {
1527 if ($PIGZ_COMP > 9) {
1536 $ip = trim($StorageNode->get(
'ip'));
1542 $storage = escapeshellcmd(
1546 trim($StorageNode->get(
'path'),
'/')
1555 $mac = $_REQUEST[
'mac'];
1565 $chkdsk = $chkdsk == 1 ? 0 : 1;
1568 (array)self::parseMacList(
1578 $addomain = preg_replace(
1583 $adou = str_replace(
1592 $aduser = preg_replace(
1597 $adpass = preg_replace(
1604 $kernelArgsArray = array(
1608 "storageip=$storageip",
1612 'value' =>
"mcastrdv=$mcastrdv",
1613 'active' => !empty($mcastrdv)
1616 'value' =>
"hostname=" .
self::$Host->
get(
'name'),
1620 'value' =>
"clamav=$clamav",
1621 'active' => in_array(
$TaskType->
get(
'id'), array(21, 22)),
1624 'value' =>
"chkdsk=$chkdsk",
1628 'value' =>
"img=$img",
1632 'value' =>
"imgType=$imgType",
1636 'value' =>
"imgPartitionType=$imgPartitionType",
1640 'value' =>
"imgid=$imgid",
1644 'value' =>
"imgFormat=$imgFormat",
1648 'value' =>
"PIGZ_COMP=-$PIGZ_COMP",
1652 'value' =>
'shutdown=1',
1653 'active' =>
$Task->get(
'shutdown') || $shutdown,
1656 'value' =>
"adon=1 addomain=\"$addomain\" "
1657 .
"adou=\"$adou\" aduser=\"$aduser\" "
1658 .
"adpass=\"$adpass\"",
1662 'value' =>
"fdrive=$fdrive",
1666 'value' =>
'hostearly=1',
1678 is_numeric($capresz)
1703 $MulticastSession->get(
'port') :
1712 $Task->get(
'passreset')
1717 'value' =>
'isdebug=yes',
1718 'active' =>
$Task->get(
'isDebug'),
1722 'active' => $kdebug,
1725 'value' =>
'seconds='.$timeout,
1726 'active' => in_array(
$TaskType->
get(
'id'), range(18, 20)),
1732 if (
$Task->get(
'typeID') == 4) {
1733 $Send[
'memtest'] = array(
1734 "$this->_memdisk iso raw",
1754 $name = preg_replace(
'#[\s]+#',
'_', $option->get(
'name'));
1756 if ($option->get(
'hotkey')) {
1757 if ($option->get(
'keysequence')) {
1760 $option->get(
'keysequence')
1764 return array(
"item${hotkey}${name} ${desc}");
1776 $name = preg_replace(
'#[\s]+#',
'_', $option->get(
'name'));
1777 $name = trim(
":$name");
1778 $type = trim($type);
1779 $Send = array($name);
1780 $params = array_filter(
1785 $option->get(
'params')
1789 if (count($params)) {
1791 $index = array_search(
'params', $params);
1792 if ($index !==
false && is_numeric($index)) {
1793 self::arrayInsertAfter(
1797 "param extraargs \"$type\""
1801 $params = trim(implode(
"\n", (array)$params));
1803 .
'param sysuuid ${uuid}';
1804 $Send = self::fastmerge($Send, array($params));
1806 switch ($option->get(
'id')) {
1808 $Send = self::fastmerge(
1810 array(
"$this->_bootexittype || goto MENU")
1814 $Send = self::fastmerge(
1817 "$this->_memdisk iso raw",
1824 $Send = self::fastmerge(
1827 "chain -ar $this->_booturl/ipxe/advanced.php || "
1834 $Send = self::fastmerge(
1837 "$this->_kernel $this->_loglevel $type",
1854 && self::getSetting(
'FOG_NO_MENU')
1858 if ($this->_hiddenmenu) {
1859 $this->_chainBoot(
true);
1862 $Menus = self::getClass(
'PXEMenuOptionsManager')->find(
'',
'',
'id');
1864 'FOG_ADVANCED_MENU_LOGIN',
1866 'FOG_IPXE_HOST_CPAIRS',
1867 'FOG_IPXE_INVALID_HOST_COLOURS',
1868 'FOG_IPXE_MAIN_COLOURS',
1869 'FOG_IPXE_MAIN_CPAIRS',
1870 'FOG_IPXE_MAIN_FALLBACK_CPAIRS',
1871 'FOG_IPXE_VALID_HOST_COLOURS',
1873 'FOG_REGISTRATION_ENABLED',
1886 ) = self::getSubObjectIDs(
1889 'name' => $ipxeGrabs
1898 $Send[
'head'] = self::fastmerge(
1900 'cpuid --ext 29 && set arch x86_64 || set arch i386',
1904 explode(
"\n", $mainColors),
1905 explode(
"\n", $mainCpairs),
1910 explode(
"\n", $mainFallback),
1914 "console --picture $this->_booturl/ipxe/$bgfile --left 100 "
1915 .
"--right 80 && goto console_set || goto alt_console",
1918 $showDebug = isset($_REQUEST[
'debug']);
1919 $hostRegColor =
self::$Host->isValid() ? $hostValid : $hostInvalid;
1920 $reg_string =
'NOT registered!';
1924 'pending approval!' :
1928 $Send[
'menustart'] = self::fastmerge(
1934 explode(
"\n", $hostCpairs),
1936 "item --gap Host is $reg_string",
1937 'item --gap -- -------------------------------------',
1940 $RegArrayOfStuff = array(
1953 $RegArrayOfStuff = array_diff($RegArrayOfStuff, array(0));
1956 array_push($RegArrayOfStuff, 3);
1959 array_push($RegArrayOfStuff, ($AdvLogin ? 5 : 4));
1961 $Menus = self::getClass(
'PXEMenuOptionsManager')->find(
1963 'regMenu' => $RegArrayOfStuff
1969 function (&$Menu) use (&$Send) {
1970 $Send[
"item-". $Menu->get(
'name')] = $this->_menuItem(
1972 trim($Menu->get(
'description'))
1978 $Send[
'default'] = array($this->_defaultChoice);
1980 function (&$Menu) use (&$Send) {
1981 $Send[
"choice-".$Menu->get(
'name')] = $this->_menuOpt(
1983 trim($Menu->get(
'args'))
1989 $Send[
'bootme'] = array(
1991 "chain -ar $this->_booturl/ipxe/boot.php##params ||",
1995 $this->_parseMe($Send);