diff options
| author | michael pereira | 2011-07-11 03:26:29 +0200 |
|---|---|---|
| committer | michael pereira | 2011-07-11 03:26:29 +0200 |
| commit | 5359c2427b83d3161bba58e1fd22b3af6d2d9605 (patch) | |
| tree | 06b1f1e550e278569232ac3f1dfd4d65048cf047 /application | |
| parent | redirect raus (diff) | |
| download | pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.tar.gz pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.tar.xz pbs2-5359c2427b83d3161bba58e1fd22b3af6d2d9605.zip | |
redirect raus
Diffstat (limited to 'application')
| -rw-r--r-- | application/modules/ipxe/controllers/ResourceController.php | 62 | ||||
| -rw-r--r-- | application/modules/ipxe/views/scripts/resource/getvesamenu.phtml | 4 |
2 files changed, 49 insertions, 17 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'); + } + } } diff --git a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml index f990f57..836d991 100644 --- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml +++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml @@ -125,10 +125,10 @@ if(isset($this->bmelist)){ if($bme->getKcl() && $kcl != null){ uriboot ( $bme->getTitle(), - "http://$this->host/ipxe/resource/start/alpha/$this->alphaID/bme/".$bme->getID(), "initrd=http://$this->host/resource/getinitramfs/alpha/$this->alphaID/file/initramfs $kcl alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend()); + "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/file/initramfs $kcl alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend()); }else{ uriboot ( $bme->getTitle(), - "http://$this->host/ipxe/resource/start/alpha/$this->alphaID/bme/".$bme->getID(), "initrd=http://$this->host/resource/getinitramfs/alpha/$this->alphaID/file/initramfs alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend()); + "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/file/initramfs alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend()); } } } |
