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

mirror-tools: new style & 2G+ file support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 30 13:29:45 2011 +0200 (2011-05-30)
parents
children b7c1161ffef7
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 if (isset($_GET['iso']))
15 $_POST['iso'] = $_GET['iso'];
17 if (isset($_GET['file']))
18 {
19 $max = floor((filesize("../".$_GET["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
20 $cmd = "cd ../".dirname($_GET['iso'])."; ls ".
21 basename($_GET['iso'],".iso").".*".
22 " | cpio -o -H newc | cat - /dev/zero ";
23 if ($_GET['file'] == "md5sum") {
24 $cmd .= "| for i in \$(seq 1 $max); do dd bs=$fdsz ".
25 "count=1 2> /dev/null | md5sum | ".
26 "sed \"s/-\\\$/\$(printf 'fdiso%02d.img' \$i)/\"; done";
27 download("md5sum", 46 * $max, $cmd);
28 }
29 else {
30 $cmd .= "| dd bs=".$fdsz." count=1 skip=".($_GET['file'] - 1)." ";
31 download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
32 }
33 }
34 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
35 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
36 <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
37 <head>
38 <title>SliTaz Boot Floppies</title>
39 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
40 <meta name="description" content="slitaz boot floppies" />
41 <meta name="robots" content="index, nofollow" />
42 <meta name="author" content="SliTaz Contributors" />
43 <link rel="shortcut icon" href="../css/favicon.ico" />
44 <link rel="stylesheet" type="text/css" href="../css/slitaz.css" />
45 <style type="text/css">
46 #copy {
47 text-align: center;
48 }
50 #bottom {
51 text-align: center;
52 }
54 </style>
55 </head>
56 <body bgcolor="#ffffff">
57 <!-- Header -->
58 <div id="header">
59 <a name="top"></a>
60 <div id="logo"></div>
61 <div id="network">
62 <a href="http://www.slitaz.org/">
63 <img src="/css/pics/network.png" alt="network.png" /></a>
64 <a href="../boot/floppy-grub4dos" title="Boot tools">Generic boot floppy</a> |
65 <a href="http://tiny.slitaz.org/" title="SliTaz for (very) old PC">Tiny SliTaz</a> |
66 <a href="index-loram.html" title="Floppy image sets for low ram systems">Loram floppies</a> |
67 <a href="builder/index.php" title="Build floppies with your own kernel and initramfs">Floppy set web builder</a> |
68 <a href="builder/bootloader" title="Build your floppy sets without Internet">Shell builder</a>
69 </div>
70 <h1><a href="http://www.slitaz.org/">Boot floppies</a></h1>
71 </div>
73 <!-- Block -->
74 <div id="block">
75 <!-- Navigation -->
76 <div id="block_nav">
77 <h4><img src="pics/floppy.png" alt="@" />Download 1.44Mb images <?php echo substr($_POST["iso"],4,3); ?></h4>
78 <table width="100%">
79 <?php
80 $max = floor((filesize("../".$_POST["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
81 for ($i = 1; $i <= $max ; $i++) {
82 if ($i % 4 == 1) echo "<tr>\n";
83 echo " <td><a href=\"download.php?file=$i&amp;iso=".
84 urlencode($_POST["iso"])."\">fdiso".
85 sprintf("%02d",$i).".img</a></td>\n";
86 if ($i % 4 == 0) echo "</tr>\n";
87 }
88 if ($max % 4 != 1) {
89 while ($max % 4 != 3) { echo "<td></td>"; $max++; }
90 }
91 else echo "<tr>\n";
92 echo " <td><a href=\"download.php?file=md5sum&amp;iso=".
93 urlencode($_POST["iso"])."\">md5sum</a></td>\n</tr>";
94 ?>
95 </table>
96 </div>
97 <!-- Information/image -->
98 <div id="block_info">
99 <h4>Available boot floppies</h4>
100 <ul>
101 <li><a href="index-3.0.html">SliTaz 3.0</a></li>
102 <li><a href="index-loram-3.0.html">SliTaz loram 3.0</a></li>
103 <li><a href="index-2.0.html">SliTaz 2.0</a></li>
104 <li><a href="index-1.0.html">SliTaz 1.0</a></li>
105 </ul>
106 </div>
107 </div>
109 <!-- Content top. -->
110 <div id="content_top">
111 <div class="top_left"></div>
112 <div class="top_right"></div>
113 </div>
115 <!-- Content -->
116 <div id="content">
118 <h2>ISO image floppy set</h2>
120 <p>
121 You can restore the <a href="../<?php echo $_POST['iso'].
122 '">'.basename($_POST['iso']); ?></a> ISO image on your hard disk using :
123 </p>
124 <pre>
125 # dd if=/dev/fd0 of=fdiso01.img
126 # dd if=/dev/fd0 of=fdiso02.img
127 # ...
128 # cat fdiso*.img | cpio -i
129 </pre>
131 <!-- End of content with round corner -->
132 </div>
133 <div id="content_bottom">
134 <div class="bottom_left"></div>
135 <div class="bottom_right"></div>
136 </div>
138 <!-- Start of footer and copy notice -->
139 <div id="copy">
140 <p>
141 Copyright &copy; <span class="year"></span> <a href="http://www.slitaz.org/">SliTaz</a> -
142 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
143 </p>
144 <!-- End of copy -->
145 </div>
147 <!-- Bottom and logo's -->
148 <div id="bottom">
149 <p>
150 <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>
151 </p>
152 </div>
154 </body>
155 </html>