summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neves2012-06-27 17:49:30 +0200
committerMichael Neves2012-06-27 17:49:30 +0200
commit1e33c186a46336fa1965147f94e8e2774844860d (patch)
tree4a8cfc0e9062fa273f533bb52059718a4d3cee16
parentipxe auth login (diff)
downloadpbs2-1e33c186a46336fa1965147f94e8e2774844860d.tar.gz
pbs2-1e33c186a46336fa1965147f94e8e2774844860d.tar.xz
pbs2-1e33c186a46336fa1965147f94e8e2774844860d.zip
ipxe resourcecontroller add bootSystem Function
-rw-r--r--application/modules/ipxe/controllers/ResourceController.php78
-rw-r--r--application/modules/ipxe/views/scripts/resource/getvesamenu.phtml14
2 files changed, 68 insertions, 24 deletions
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php
index 8a03dca..ce1de6e 100644
--- a/application/modules/ipxe/controllers/ResourceController.php
+++ b/application/modules/ipxe/controllers/ResourceController.php
@@ -33,18 +33,6 @@ class Ipxe_ResourceController extends Zend_Controller_Action {
$this->session->setID($result[0]['sessionID']);
}
- $bootmenuntryID = $this->_request->getParam('bme');
-
- if(isset($bootmenuntryID) && isset($this->session)) {
- //TODO check if allowed
- $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);
- }
}
public function getvesamenuconfigAction() {
@@ -149,6 +137,29 @@ class Ipxe_ResourceController extends Zend_Controller_Action {
echo $vesamenu;
}
+ public function getsignatureAction() {
+ $bootosID = $this->session->getBootosID();
+ $file = $this->_request->getParam('file');
+
+ if(is_dir("../resources/bootos/$bootosID/signatures/") && 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="'.$file.'.sig"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/bootos/$bootosID/signatures/");
+
+ header("Content-Length: ".filesize(getcwd()."/".$file.".sig"));
+
+ passthru( "cat ". $file.".sig");
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
public function getkernelAction() {
//TODO session & bme error
@@ -197,6 +208,49 @@ class Ipxe_ResourceController extends Zend_Controller_Action {
header('HTTP/1.0 404 Not Found');
}
}
+
+ public function bootSystem() {
+
+ $bootmenuntryID = $this->_request->getParam('bme');
+
+ if(isset($bootmenuntryID) && isset($this->session)) {
+ //TODO check if allowed
+ $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 .= "kernel --name kernel $this->httpmode://$this->host/ipxe/resource/getkernel/alpha/".$this->session->getAlphasessionID();
+ $result .= "initrd --name initramfs $this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/".$this->session->getAlphasessionID();
+
+ if($bootmenuentry->getKcl() && $kcl != null){
+ $result .= "imgargs kernel $kcl alpha=".$this->session->getAlphasessionID()."file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bme->getKclappend();
+ }else{
+ $result .= "imgargs kernel alpha=".$this->session->getAlphasessionID()."file=$this->httpmode://$this->host/c/".$this->session->getAlphasessionID()."/default.tgz ".$bme->getKclappend();
+ }
+ $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 e3c2bf6..17fda91 100644
--- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
+++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
@@ -149,21 +149,11 @@ MENU MSGCOLOR #ff1c2a33 #00000000 none
}else{
title ( $this->title);
-
- $bootosmapper = new Application_Model_BootOsMapper();
if(isset($this->bmelist)){
foreach($this->bmelist as $bme){
-
- $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
-
- if($bme->getKcl() && $kcl != null){
- uriboot ( $bme->getTitle(),
- "$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
- }else{
- uriboot ( $bme->getTitle(),
- "$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
- }
+ uriboot ( $bme->getTitle(),
+ "$this->httpmode://$this->host/ipxe/resource/bootSystem/alpha/$this->alphaID/bme/".$bme->getID(), "");
}
}else{
nobootmenu();