slitaz-forge diff mirror/floppies/download.php @ rev 349

mirror: add QR code (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 20 19:56:45 2013 +0100 (2013-03-20)
parents
children e6e4be1b2591
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mirror/floppies/download.php	Wed Mar 20 19:56:45 2013 +0100
     1.3 @@ -0,0 +1,163 @@
     1.4 +<?php
     1.5 +
     1.6 +$fdsz=80*18*1024;
     1.7 +$cpiopad=512;
     1.8 +function download($name, $size, $cmd)
     1.9 +{
    1.10 +	header("Content-Type: application/octet-stream");
    1.11 +	header("Content-Length: ".$size);
    1.12 +	header("Content-Disposition: attachment; filename=".$name);
    1.13 +	echo `$cmd 2> /dev/null`;
    1.14 +	exit;
    1.15 +}
    1.16 +
    1.17 +function my_filesize($path)	// 2G+ file support
    1.18 +{
    1.19 +	return rtrim(shell_exec("stat -c %s '".$path."'"));
    1.20 +}
    1.21 +
    1.22 +if (isset($_GET['iso']))
    1.23 +	$_POST['iso'] = $_GET['iso'];
    1.24 +
    1.25 +if (isset($_GET['file']))
    1.26 +{
    1.27 +	$max = floor((my_filesize("../".$_GET["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
    1.28 +	$cmd = "cd ../".dirname($_GET['iso'])."; ls ".
    1.29 +		basename($_GET['iso'],".iso").".*".
    1.30 +		" | cpio -o -H newc | cat - /dev/zero ";
    1.31 +	if ($_GET['file'] == "md5sum") {
    1.32 +		$cmd .= "| for i in \$(seq 1 $max); do dd bs=$fdsz ".
    1.33 +			"count=1 2> /dev/null | md5sum | ".
    1.34 +			"sed \"s/-\\\$/\$(printf 'fdiso%02d.img' \$i)/\"; done";
    1.35 +		download("md5sum", 46 * $max, $cmd);
    1.36 +	}
    1.37 +	else {
    1.38 +		$cmd .= "| dd bs=".$fdsz." count=1 skip=".($_GET['file'] - 1)." "; 
    1.39 +		download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
    1.40 +	}
    1.41 +}
    1.42 +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    1.43 +	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    1.44 +<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
    1.45 +<head>
    1.46 +	<title>SliTaz Boot Floppies</title>
    1.47 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    1.48 +	<meta name="description" content="slitaz boot floppies" />
    1.49 +	<meta name="robots" content="index, nofollow" />
    1.50 +	<meta name="author" content="SliTaz Contributors" />
    1.51 +	<link rel="shortcut icon" href="../css/favicon.ico" />
    1.52 +	<link rel="stylesheet" type="text/css" href="../css/slitaz.css" />
    1.53 +	<style type="text/css">
    1.54 +#copy {
    1.55 +	text-align: center;
    1.56 +}
    1.57 +
    1.58 +#bottom {
    1.59 +	text-align: center;
    1.60 +}
    1.61 +
    1.62 +	</style>
    1.63 +</head>
    1.64 +<body bgcolor="#ffffff">
    1.65 +<!-- Header -->
    1.66 +<div id="header">
    1.67 +    <a name="top"></a>
    1.68 +	<div id="logo"></div>
    1.69 +	<div id="network">
    1.70 +		<a href="http://www.slitaz.org/">
    1.71 +		<img src="/css/pics/network.png" alt="network.png" /></a>
    1.72 +		<a href="floppy-grub4dos" title="Boot tools">Generic boot floppy</a> |
    1.73 +		<a href="http://tiny.slitaz.org/" title="SliTaz in one floppy !">Tiny SliTaz</a> |
    1.74 +		<a href="index-loram.html" title="Floppy image sets for low ram systems">Loram floppies</a> |
    1.75 +		<a href="builder/index.php" title="Build floppies with your own kernel and initramfs">Floppy set web builder</a> |
    1.76 +		<a href="builder/bootloader" title="Build your floppy sets without Internet">Shell builder</a>
    1.77 +	</div>
    1.78 +	<h1><a href="http://www.slitaz.org/">Boot floppies</a></h1>
    1.79 +</div>   
    1.80 +
    1.81 +<!-- Block -->
    1.82 +<div id="block">
    1.83 +	<!-- Navigation -->
    1.84 +	<div id="block_nav">
    1.85 +		<h4><img src="pics/floppy.png" alt="@" />Download 1.44Mb images for <?php $dir = explode('/',$_POST["iso"]); echo $dir[1]; ?></h4>
    1.86 +<table width="100%">
    1.87 +<?php
    1.88 +$max = floor((my_filesize("../".$_POST["iso"]) + $fdsz - 1 + $cpiopad) / $fdsz);
    1.89 +for ($i = 1; $i <= $max ; $i++) {
    1.90 +	if ($i % 4 == 1) echo "<tr>\n";
    1.91 +	echo "	<td><a href=\"download.php?file=$i&amp;iso=".
    1.92 +		urlencode($_POST["iso"])."\">fdiso".sprintf("%02d",$i);
    1.93 +	if ($max < 100) echo ".img";
    1.94 +	echo "</a></td>\n";
    1.95 +	if ($i % 4 == 0) echo "</tr>\n";
    1.96 +}
    1.97 +if ($max % 4 != 0) {
    1.98 +	while ($max % 4 != 3) { echo "<td></td>"; $max++; }
    1.99 +}
   1.100 +else echo "<tr>\n";
   1.101 +echo "	<td><a href=\"download.php?file=md5sum&amp;iso=".
   1.102 +	urlencode($_POST["iso"])."\">md5sum</a></td>\n</tr>";
   1.103 +?>
   1.104 +</table>
   1.105 +	</div>
   1.106 +	<!-- Information/image -->
   1.107 +	<div id="block_info">
   1.108 +		<h4>Available boot floppies</h4>
   1.109 +		<ul>
   1.110 +	<li><a href="index-4.0.html">SliTaz 4.0</a></li>
   1.111 +	<li><a href="index-loram-4.0.html">SliTaz loram 4.0</a></li>
   1.112 +	<li><a href="index-3.0.html">SliTaz 3.0</a></li>
   1.113 +	<li><a href="index-loram-3.0.html">SliTaz loram 3.0</a></li>
   1.114 +	<li><a href="index-2.0.html">SliTaz 2.0</a></li>
   1.115 +	<li><a href="index-1.0.html">SliTaz 1.0</a></li>
   1.116 +		</ul>
   1.117 +	</div>
   1.118 +</div>
   1.119 +
   1.120 +<!-- Content top. -->
   1.121 +<div id="content_top">
   1.122 +<div class="top_left"></div>
   1.123 +<div class="top_right"></div>
   1.124 +</div>
   1.125 +
   1.126 +<!-- Content -->
   1.127 +<div id="content">
   1.128 +
   1.129 +<h2>ISO image floppy set</h2>
   1.130 +
   1.131 +<p>
   1.132 +You can restore the <a href="../<?php echo $_POST['iso'].
   1.133 +'">'.basename($_POST['iso']); ?></a> ISO image on your hard disk using :
   1.134 +</p>
   1.135 +<pre>
   1.136 +# dd if=/dev/fd0 of=fdiso01.img
   1.137 +# dd if=/dev/fd0 of=fdiso02.img
   1.138 +# ...
   1.139 +# cat fdiso*.img | cpio -i
   1.140 +</pre>
   1.141 +
   1.142 +<!-- End of content with round corner -->
   1.143 +</div>
   1.144 +<div id="content_bottom">
   1.145 +<div class="bottom_left"></div>
   1.146 +<div class="bottom_right"></div>
   1.147 +</div>
   1.148 +
   1.149 +<!-- Start of footer and copy notice -->
   1.150 +<div id="copy">
   1.151 +<p>
   1.152 +Copyright &copy; <span class="year"></span> <a href="http://www.slitaz.org/">SliTaz</a> -
   1.153 +<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
   1.154 +</p>
   1.155 +<!-- End of copy -->
   1.156 +</div>
   1.157 +
   1.158 +<!-- Bottom and logo's -->
   1.159 +<div id="bottom">
   1.160 +<p>
   1.161 +<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>
   1.162 +</p>
   1.163 +</div>
   1.164 +
   1.165 +</body>
   1.166 +</html>