summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-06-29 18:00:44 -0400
committerEudyptula <eitan@mosenkis.net>2009-06-29 18:00:44 -0400
commitd0172b464174f6ebc17a93f84e901618dd648adc (patch)
tree8e64402243d5b9a2e9dd8564dc1fcfba0fa8fb25 /frontend
parentAdded an send invitations form to frontend and email notifications to backend (diff)
downloadingenue-d0172b464174f6ebc17a93f84e901618dd648adc.tar.gz
ingenue-d0172b464174f6ebc17a93f84e901618dd648adc.tar.bz2
ingenue-d0172b464174f6ebc17a93f84e901618dd648adc.zip
Added image format option to frontend, tbz2 and preliminary Install CD and LiveCD support to backend
Diffstat (limited to 'frontend')
-rw-r--r--frontend/pages/downloadimage.php21
-rw-r--r--frontend/wizard/step2.php1
-rw-r--r--frontend/wizard/step3.php18
3 files changed, 34 insertions, 6 deletions
diff --git a/frontend/pages/downloadimage.php b/frontend/pages/downloadimage.php
index aaa48b3..7346e6a 100644
--- a/frontend/pages/downloadimage.php
+++ b/frontend/pages/downloadimage.php
@@ -14,16 +14,27 @@ function init_downloadimage() {
return '404';
}
$build=new sql_build($r->fetch(PDO::FETCH_ASSOC));
- $S['file']=COMPLETED.'/build-'.$build->id.'.tar.gz';
- if (!is_file($S['file'])) {
- debug('downloadimage', 'image file '.$S['file'].' not found');
+ $files=glob(COMPLETED.'/build-'.$build->id.'.*');
+ if (count($files)) {
+ if (count($files) > 1) {
+ debug('downloadimage', 'extraneous file(s) found - don\'t know which to give them');
+ return '404';
+ }
+ $S['file']=$files[0];
+ if (!is_readable($S['file'])) {
+ debug('downloadimage', 'found file, but no read perms');
+ return '404';
+ }
+ $ext=substr($S['file'], strpos($S['file'], '.'));
+ } else {
+ debug('downloadimage', 'image file not found');
return '404';
}
- contenttype('application/x-gzip');
+ contenttype('application/octet-stream');
header('Content-Length: '.filesize($S['file']));
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
- header('Content-Disposition: attachment; filename="ingenue-'.$build->id.'.tar.gz"');
+ header('Content-Disposition: attachment; filename="ingenue-'.$build->id.$ext);
}
function body_downloadimage() {
global $S;
diff --git a/frontend/wizard/step2.php b/frontend/wizard/step2.php
index 1978f92..7667b95 100644
--- a/frontend/wizard/step2.php
+++ b/frontend/wizard/step2.php
@@ -33,6 +33,5 @@ function wizard_process_step2() {
$opt=new sql_buildopt($S['wizard.build']->id, 'install_packages', $packages);
$opt->write();
}
- return true;
}
?>
diff --git a/frontend/wizard/step3.php b/frontend/wizard/step3.php
new file mode 100644
index 0000000..42e5211
--- /dev/null
+++ b/frontend/wizard/step3.php
@@ -0,0 +1,18 @@
+<?php
+function wizard_init_step3() {
+ return array('title' => 'Step 3 - Image Format');
+}
+function wizard_body_step3() {
+ echo 'Image type: <select name="image_type"><option value="tgz">Tar/Gzip</option><option value="tbz2">Tar/Bzip2</option><option value="installcd">Installer CD with Tar/Bzip2 image</option><option value="livecd">LiveCD</option></select><br/>';
+}
+function wizard_process_step3() {
+ global $S, $request;
+ if (isset($request['image_type'])) {
+ debug('wizard', 'step3: image type='.$request['image_type']);
+ $opt=new sql_buildopt($S['wizard.build']->id, 'image_type', $request['image_type']);
+ $opt->write();
+ } else {
+ debug('wizard', 'step3: no image_type variable');
+ }
+ return true;
+}