summaryrefslogtreecommitdiffstats
path: root/application/modules/dev/controllers/PrebootController.php
diff options
context:
space:
mode:
authormichael pereira2011-03-22 12:31:56 +0100
committermichael pereira2011-03-22 12:31:56 +0100
commit04475ff1a1df3a0cc523117e6288401808946d43 (patch)
tree6ecb79417d6db5ca2c5de604df9f31c96c7ae74e /application/modules/dev/controllers/PrebootController.php
parentBootos fix (diff)
downloadpbs2-04475ff1a1df3a0cc523117e6288401808946d43.tar.gz
pbs2-04475ff1a1df3a0cc523117e6288401808946d43.tar.xz
pbs2-04475ff1a1df3a0cc523117e6288401808946d43.zip
Bootiso & Preboot update
Diffstat (limited to 'application/modules/dev/controllers/PrebootController.php')
-rw-r--r--application/modules/dev/controllers/PrebootController.php43
1 files changed, 32 insertions, 11 deletions
diff --git a/application/modules/dev/controllers/PrebootController.php b/application/modules/dev/controllers/PrebootController.php
index df8daf2..5271450 100644
--- a/application/modules/dev/controllers/PrebootController.php
+++ b/application/modules/dev/controllers/PrebootController.php
@@ -53,12 +53,11 @@ class dev_PrebootController extends Zend_Controller_Action
$prebootID = $prebootmapper->save($preboot);
$path_preboot = "../resources/bootmedium/$prebootID/";
- mkdir($path_preboot."preboot/",0777,true);
+ mkdir($path_preboot ,0777, true);
- exec("wget -O '".$path_preboot."preboot.tgz' ".$preboot->getPath_preboot());
-
- exec("tar -xvf ".$path_preboot."preboot.tgz "."-C ".$path_preboot."preboot/");
-
+ exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
+
+
}catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";
@@ -81,8 +80,8 @@ class dev_PrebootController extends Zend_Controller_Action
$prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
- if(is_file("../resources/bootmedium/$prebootID/preboot.tgz"))
- $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.tgz");
+ if(is_file("../resources/bootmedium/$prebootID/preboot.zip"))
+ $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip");
else
$prebootolddate = false;
@@ -98,6 +97,7 @@ class dev_PrebootController extends Zend_Controller_Action
public function updateprebootAction()
{
+
$prebootID = $this->_request->getParam('prebootID');
$prebootmapper = new Application_Model_PreBootMapper();
@@ -106,10 +106,31 @@ class dev_PrebootController extends Zend_Controller_Action
$path_preboot = "../resources/bootmedium/$prebootID/";
- exec("rm -r $path_preboot"."preboot/*");
-
- exec("wget -O '".$path_preboot."preboot.tgz' ".$preboot->getPath_preboot());
- exec("tar -xvf ".$path_preboot."preboot.tgz "."-C ".$path_preboot."preboot/");
+ exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
+
+ $filelist = array();
+ $filelist = scandir($path_preboot);
+
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+
+ foreach($filelist as $file){
+ if($file == "." || $file == ".." || $file == "preboot.zip"){
+ //do nothing
+ }
+ else{
+ $bootisoID = str_replace('.zip', '', $file);
+ $serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
+
+ 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", $serialnumber);
+ $zip->close();
+ }
+ }
+ }
$this->_redirect('/dev/preboot');
}