diff options
author | Michael Neves | 2012-06-27 18:21:09 +0200 |
---|---|---|
committer | Michael Neves | 2012-06-27 18:21:09 +0200 |
commit | 6df6f052404600e8a0cfa3c53e8a2c9da1a1475f (patch) | |
tree | 367fea52e525f9c097db571405c9540a8daab880 | |
parent | ipxe resourcecontroller add bootSystem Function (diff) | |
download | pbs2-6df6f052404600e8a0cfa3c53e8a2c9da1a1475f.tar.gz pbs2-6df6f052404600e8a0cfa3c53e8a2c9da1a1475f.tar.xz pbs2-6df6f052404600e8a0cfa3c53e8a2c9da1a1475f.zip |
ipxe boottustedsystem
-rw-r--r-- | application/modules/ipxe/controllers/ResourceController.php | 48 | ||||
-rw-r--r-- | application/modules/ipxe/views/scripts/resource/getvesamenu.phtml | 2 |
2 files changed, 48 insertions, 2 deletions
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php index 8ca9195..686abab 100644 --- a/application/modules/ipxe/controllers/ResourceController.php +++ b/application/modules/ipxe/controllers/ResourceController.php @@ -253,7 +253,7 @@ class Ipxe_ResourceController extends Zend_Controller_Action { }else{ $result .= "imgargs kernel alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; } - //$result .= "boot"; + $result .= "boot"; } else { $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/session\n"; @@ -264,6 +264,52 @@ class Ipxe_ResourceController extends Zend_Controller_Action { } + public function boottrustedsystemAction() { + + $bootmenuntryID = $this->_request->getParam('bme'); + + if(isset($bootmenuntryID) && isset($this->session)) { + //TODO check if allowed + $sessionMapper = new Application_Model_SessionMapper(); + $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); + $bootmenuentry = new Application_Model_BootMenuEntries(); + $bootmenuentriesMapper->find($bootmenuntryID, $bootmenuentry); + + $this->session->setBootmenuentryID($bootmenuntryID); + $this->session->setBootosID($bootmenuentry->getBootosID()); + $sessionMapper->save($this->session); + } + + header('Content-Type: text/plain'); + + $result = "#!ipxe\n"; + if(isset($this->session)) { + $bootosID = $this->session->getBootosID(); + $bootosmapper = new Application_Model_BootOsMapper(); + + $kcl = $bootosmapper->find($bootosID)->getDefaultkcl(); + + $result .= "imgtrust --permanent"; + $result .= "kernel --name kernel $this->httpmode://$this->host/ipxe/resource/getkernel/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "imgverify kernel $this->httpmode://$this->host/ipxe/resource/getsignature/file/kernel/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "initrd --name initramfs $this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/".$this->session->getAlphasessionID()."\n"; + $result .= "imgverify initramfs $this->httpmode://$this->host/ipxe/resource/getsignature/file/initramfs/alpha/".$this->session->getAlphasessionID()."\n"; + + if($bootmenuentry->getKcl() && $kcl != null){ + $result .= "imgargs kernel $kcl alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; + }else{ + $result .= "imgargs kernel alpha=".$this->session->getAlphasessionID()." file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bootmenuentry->getKclappend()."\n"; + } + $result .= "boot"; + + } else { + $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/session\n"; + } + header("Content-Length: ".(strlen($result))); + echo $result; + + + } } diff --git a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml index 17fda91..8de8285 100644 --- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml +++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml @@ -153,7 +153,7 @@ MENU MSGCOLOR #ff1c2a33 #00000000 none if(isset($this->bmelist)){ foreach($this->bmelist as $bme){ uriboot ( $bme->getTitle(), - "$this->httpmode://$this->host/ipxe/resource/bootSystem/alpha/$this->alphaID/bme/".$bme->getID(), ""); + "$this->httpmode://$this->host/ipxe/resource/boottrustedsystem/alpha/$this->alphaID/bme/".$bme->getID(), ""); } }else{ nobootmenu(); |