slitaz-dev-tools view mirror-tools/slitaz/mirror/floppies/download.php @ rev 185

Update http://floppy.slitaz.org/
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 28 11:28:54 2012 +0200 (2012-07-28)
parents 116c7b18fea2
children 1c207a9e6d0c
line source
1 <?php
3 $fdsz=80*18*1024;
4 $cpiopad=512;
5 function download($name, $size, $cmd)
6 {
7 header("Content-Type: application/octet-stream");
8 header("Content-Length: ".$size);
9 header("Content-Disposition: attachment; filename=".$name);
10 echo `$cmd 2> /dev/null`;
11 exit;
12 }
14 function my_filesize($path) // 2G+ file support
15 {
16 return rtrim(shell_exec("stat -c %s '".$path."'"));
17 }
19 if (isset($_GET['iso']))
20 $_POST['iso'] = $_GET['iso'];
22 if (isset($_GET['file']))
23 {
24 $max = floor((my_filesize("../".$_GET["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
25 $cmd = "cd ../".dirname($_GET['iso'])."; ls ".
26 basename($_GET['iso'],".iso").".*".
27 " | cpio -o -H newc | cat - /dev/zero ";
28 if ($_GET['file'] == "md5sum") {
29 $cmd .= "| for i in \$(seq 1 $max); do dd bs=$fdsz ".
30 "count=1 2> /dev/null | md5sum | ".
31 "sed \"s/-\\\$/\$(printf 'fdiso%02d.img' \$i)/\"; done";
32 download("md5sum", 46 * $max, $cmd);
33 }
34 else {
35 $cmd .= "| dd bs=".$fdsz." count=1 skip=".($_GET['file'] - 1)." ";
36 download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
37 }
38 }
39 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
40 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41 <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
42 <head>
43 <title>SliTaz Boot Floppies</title>
44 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
45 <meta name="description" content="slitaz boot floppies" />
46 <meta name="robots" content="index, nofollow" />
47 <meta name="author" content="SliTaz Contributors" />
48 <link rel="shortcut icon" href="../css/favicon.ico" />
49 <link rel="stylesheet" type="text/css" href="../css/slitaz.css" />
50 <style type="text/css">
51 #copy {
52 text-align: center;
53 }
55 #bottom {
56 text-align: center;
57 }
59 </style>
60 </head>
61 <body bgcolor="#ffffff">
62 <!-- Header -->
63 <div id="header">
64 <a name="top"></a>
65 <div id="logo"></div>
66 <div id="network">
67 <a href="http://www.slitaz.org/">
68 <img src="/css/pics/network.png" alt="network.png" /></a>
69 <a href="floppy-grub4dos" title="Boot tools">Generic boot floppy</a> |
70 <a href="http://tiny.slitaz.org/" title="SliTaz in one floppy !">Tiny SliTaz</a> |
71 <a href="index-loram.html" title="Floppy image sets for low ram systems">Loram floppies</a> |
72 <a href="builder/index.php" title="Build floppies with your own kernel and initramfs">Floppy set web builder</a> |
73 <a href="builder/bootloader" title="Build your floppy sets without Internet">Shell builder</a>
74 </div>
75 <h1><a href="http://www.slitaz.org/">Boot floppies</a></h1>
76 </div>
78 <!-- Block -->
79 <div id="block">
80 <!-- Navigation -->
81 <div id="block_nav">
82 <h4><img src="pics/floppy.png" alt="@" />Download 1.44Mb images for <?php $dir = explode('/',$_POST["iso"]); echo $dir[1]; ?></h4>
83 <table width="100%">
84 <?php
85 $max = floor((my_filesize("../".$_POST["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
86 for ($i = 1; $i <= $max ; $i++) {
87 if ($i % 4 == 1) echo "<tr>\n";
88 echo " <td><a href=\"download.php?file=$i&amp;iso=".
89 urlencode($_POST["iso"])."\">fdiso".sprintf("%02d",$i);
90 if ($max < 100) echo ".img";
91 echo "</a></td>\n";
92 if ($i % 4 == 0) echo "</tr>\n";
93 }
94 if ($max % 4 != 0) {
95 while ($max % 4 != 3) { echo "<td></td>"; $max++; }
96 }
97 else echo "<tr>\n";
98 echo " <td><a href=\"download.php?file=md5sum&amp;iso=".
99 urlencode($_POST["iso"])."\">md5sum</a></td>\n</tr>";
100 ?>
101 </table>
102 </div>
103 <!-- Information/image -->
104 <div id="block_info">
105 <h4>Available boot floppies</h4>
106 <ul>
107 <li><a href="index-4.0.html">SliTaz 4.0</a></li>
108 <li><a href="index-loram-4.0.html">SliTaz loram 4.0</a></li>
109 <li><a href="index-3.0.html">SliTaz 3.0</a></li>
110 <li><a href="index-loram-3.0.html">SliTaz loram 3.0</a></li>
111 <li><a href="index-2.0.html">SliTaz 2.0</a></li>
112 <li><a href="index-1.0.html">SliTaz 1.0</a></li>
113 </ul>
114 </div>
115 </div>
117 <!-- Content top. -->
118 <div id="content_top">
119 <div class="top_left"></div>
120 <div class="top_right"></div>
121 </div>
123 <!-- Content -->
124 <div id="content">
126 <h2>ISO image floppy set</h2>
128 <p>
129 You can restore the <a href="../<?php echo $_POST['iso'].
130 '">'.basename($_POST['iso']); ?></a> ISO image on your hard disk using :
131 </p>
132 <pre>
133 # dd if=/dev/fd0 of=fdiso01.img
134 # dd if=/dev/fd0 of=fdiso02.img
135 # ...
136 # cat fdiso*.img | cpio -i
137 </pre>
139 <!-- End of content with round corner -->
140 </div>
141 <div id="content_bottom">
142 <div class="bottom_left"></div>
143 <div class="bottom_right"></div>
144 </div>
146 <!-- Start of footer and copy notice -->
147 <div id="copy">
148 <p>
149 Copyright &copy; <span class="year"></span> <a href="http://www.slitaz.org/">SliTaz</a> -
150 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
151 </p>
152 <!-- End of copy -->
153 </div>
155 <!-- Bottom and logo's -->
156 <div id="bottom">
157 <p>
158 <a href="http://validator.w3.org/check?uri=referer"><img src="../css/pics/website/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
159 </p>
160 </div>
162 </body>
163 </html>