summaryrefslogtreecommitdiffstats
path: root/application/modules/ipxe/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/ipxe/controllers')
-rw-r--r--application/modules/ipxe/controllers/ResourceController.php62
1 files changed, 47 insertions, 15 deletions
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php
index 1a14502..6d4192a 100644
--- a/application/modules/ipxe/controllers/ResourceController.php
+++ b/application/modules/ipxe/controllers/ResourceController.php
@@ -98,32 +98,64 @@ class Ipxe_ResourceController extends Zend_Controller_Action
echo $vesamenu;
}
- public function startAction(){
+ public function getkernelAction(){
$bootmenuntryID = $this->_request->getParam('bme');
- $a = $this->thisSession->getAlphasessionID();
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
- $sessionMapper = new Application_Model_SessionMapper();
- $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
- $session = new Application_Model_Session();
- $session->setOptions($session_k[0]);
- $session->setID($session_k[0]['sessionID']);
+ $this->thisSession->setBootmenuentryID($bootmenuntryID);
+ $this->thisSession->setBootosID($bootmenuentry->getBootosID());
+ $sessionMapper->save($this->thisSession);
- $session->setBootmenuentryID($bootmenuntryID);
- $session->setBootosID($bootmenuentry->getBootosID());
- $sessionMapper->save($session);
-
- $this->_redirect('/resource/getkernel/alpha/'.$session->getAlphasessionID());
-
+ $bootosID = $this->thisSession->getBootosID();
-
+ if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/bootos/$bootosID/kernel/");
+ $kernelname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$kernelname));
+
+ passthru( "cat ". $kernelname);
+ }else{
+ header('HTTP/1.0 404 Not Found');
+ }
}
+ public function getinitramfsAction()
+ {
+
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create file.
+ chdir("../resources/bootos/$bootosID/initramfs/");
+ $initname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$initname));
+
+ passthru( "cat ".$initname);
+ }else{
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
}