summaryrefslogtreecommitdiffstats
path: root/application/modules/dev/controllers/BootisoController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/dev/controllers/BootisoController.php')
-rw-r--r--application/modules/dev/controllers/BootisoController.php59
1 files changed, 44 insertions, 15 deletions
diff --git a/application/modules/dev/controllers/BootisoController.php b/application/modules/dev/controllers/BootisoController.php
index 901c901..da3e4c2 100644
--- a/application/modules/dev/controllers/BootisoController.php
+++ b/application/modules/dev/controllers/BootisoController.php
@@ -31,28 +31,34 @@ class dev_BootisoController extends Zend_Controller_Action
public function downloadbootisoAction()
{
$this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
+ $this->_helper->viewRenderer->setNoRender(true);
$prebootID = $this->_request->getParam('prebootID');
$serialnumber = $this->_request->getParam('serialnumber');
if(is_dir("../resources/bootmedium/$prebootID/") && is_numeric($prebootID)){
- 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="preboot.zip"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- $fp = fopen("bootisoSerial.txt", "w");
+// 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="preboot.tgz"');
+// header('Pragma: no-cache');
+// header('Expires: 0');
+
+ chdir("../resources/bootmedium/$prebootID/preboot/");
+ $prebootname = array_pop(scandir("./"));
+ print_a($prebootname);
+
+ $fp = fopen($prebootname."/build/rootfs/tmp/proobootisoSerial.txt", "w");
fputs ($fp, $serialnumber);
fclose ($fp);
// create the gzipped tarfile.
- chdir("../resources/bootmedium/$prebootID/preboot/");
- passthru("zip -r - ./");
- }
+ passthru("tar -cvz ./");
+
+
+
+ }
@@ -77,9 +83,20 @@ class dev_BootisoController extends Zend_Controller_Action
$bootisomapper = new Application_Model_BootIsoMapper();
$bootiso->setCreated(time());
+ $prebootID = $bootiso->getPrebootID();
+
try {
- $bootisomapper->save($bootiso);
+ $bootisoID = $bootisomapper->save($bootiso);
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
}catch(Zend_Exception $e)
{
@@ -96,7 +113,7 @@ class dev_BootisoController extends Zend_Controller_Action
public function editbootisoAction()
{
- $bootisoID = $this->_request->getParam('bootisoID');
+ $bootisoID = $this->_request->getParam('bootisoID');
$groupmapper = new Application_Model_GroupMapper();
$prebootmapper = new Application_Model_PreBootMapper();
@@ -123,9 +140,21 @@ class dev_BootisoController extends Zend_Controller_Action
$bootisomapper = new Application_Model_BootIsoMapper();
$bootiso->setCreated(time());
$bootiso->setID($bootisoID);
-
+ $prebootID = $bootiso->getPrebootID();
+
try {
- $bootisomapper->save($bootiso);
+
+
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res === true){
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/mnt/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ $bootisomapper->save($bootiso);
+
}catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";