slitaz-forge rev 696

Fix floppies/download.php
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 24 21:59:25 2018 +0200 (2018-06-24)
parents 95605b3559a8
children ccbd176f0619
files mirror/floppies/download.php mirror/floppies/floppies mirror/floppies/mkfdrolling.sh mirror/floppies/mkindex.sh
line diff
     1.1 --- a/mirror/floppies/download.php	Fri Apr 27 11:29:08 2018 +0200
     1.2 +++ b/mirror/floppies/download.php	Sun Jun 24 21:59:25 2018 +0200
     1.3 @@ -26,13 +26,17 @@
     1.4  		basename($_GET['iso'],".iso").".*".
     1.5  		" | cpio -o -H newc | cat - /dev/zero ";
     1.6  	if ($_GET['file'] == "md5sum") {
     1.7 -		$cmd .= "| for i in \$(seq 1 $max); do dd bs=$fdsz ".
     1.8 -			"count=1 2> /dev/null | md5sum | ".
     1.9 +		$cmd .= "| for i in \$(seq 1 $max); do dd conv=sync bs=4k ".
    1.10 +			"count=".($fdsz/4096)." 2> /dev/null | md5sum | ".
    1.11  			"sed \"s/-\\\$/\$(printf 'fdiso%02d.img' \$i)/\"; done";
    1.12 -		download("md5sum", 46 * $max, $cmd);
    1.13 +		$len = 46 * $max;
    1.14 +		$cmd .= "; md5sum ".basename($_GET['iso']);
    1.15 +		$len += strlen(basename($_GET['iso'])) + 35;
    1.16 +		download("md5sum", $len, $cmd);
    1.17  	}
    1.18  	else {
    1.19 -		$cmd .= "| dd bs=".$fdsz." count=1 skip=".($_GET['file'] - 1)." "; 
    1.20 +		$cmd .= "| dd bs=4k count=".($fdsz/4096)." conv=sync skip=".
    1.21 +			(($_GET['file'] - 1)*($fdsz/4096))." "; 
    1.22  		download(sprintf("fdiso%02d.img",$_GET['file']), $fdsz, $cmd);
    1.23  	}
    1.24  }
    1.25 @@ -81,8 +85,9 @@
    1.26  for ($i = 1; file_exists("index-$i.0.html") ; $i++);
    1.27  while (--$i > 0) {
    1.28  	echo "			<li><a href=\"index-$i.0.html\">SliTaz $i.0</a>";
    1.29 -	if (file_exists("index-loram-".$i.".0.html"))
    1.30 -		echo "				· <a href=\"index-loram-$i.0.html\">loram</a>";
    1.31 +	foreach (array("loram","web","mini") as $flavor)
    1.32 +	    if (file_exists("index-".$flavor."-".$i.".0.html"))
    1.33 +		echo "				&middot; <a href=\"index-".$flavor."-$i.0.html\">".$flavor."</a>";
    1.34  	echo "			</li>\n";
    1.35  }
    1.36  ?>
    1.37 @@ -155,24 +160,24 @@
    1.38  
    1.39  <footer>
    1.40  	<div>
    1.41 -		Copyright © <span class="year"></span>
    1.42 +		Copyright &copy; <span class="year"></span>
    1.43  		<a href="http://www.slitaz.org/">SliTaz</a>
    1.44  	</div>
    1.45  	<div>
    1.46  		Network:
    1.47 -		<a href="http://scn.slitaz.org/">Community</a> ·
    1.48 -		<a href="http://doc.slitaz.org/">Doc</a> ·
    1.49 -		<a href="http://forum.slitaz.org/">Forum</a> ·
    1.50 -		<a href="http://pkgs.slitaz.org/">Packages</a> ·
    1.51 -		<a href="http://bugs.slitaz.org">Bugs</a> ·
    1.52 +		<a href="http://scn.slitaz.org/">Community</a> &middot;
    1.53 +		<a href="http://doc.slitaz.org/">Doc</a> &middot;
    1.54 +		<a href="http://forum.slitaz.org/">Forum</a> &middot;
    1.55 +		<a href="http://pkgs.slitaz.org/">Packages</a> &middot;
    1.56 +		<a href="http://bugs.slitaz.org">Bugs</a> &middot;
    1.57  		<a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
    1.58  	</div>
    1.59  	<div>
    1.60  		SliTaz @
    1.61 -		<a href="http://twitter.com/slitaz">Twitter</a> ·
    1.62 -		<a href="http://www.facebook.com/slitaz">Facebook</a> ·
    1.63 -		<a href="http://distrowatch.com/slitaz">Distrowatch</a> ·
    1.64 -		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> ·
    1.65 +		<a href="http://twitter.com/slitaz">Twitter</a> &middot;
    1.66 +		<a href="http://www.facebook.com/slitaz">Facebook</a> &middot;
    1.67 +		<a href="http://distrowatch.com/slitaz">Distrowatch</a> &middot;
    1.68 +		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> &middot;
    1.69  		<a href="http://flattr.com/profile/slitaz">Flattr</a>
    1.70  	</div>
    1.71  	<img src="/static/qr.png" alt="#" onmouseover="this.title = location.href"
     2.1 --- a/mirror/floppies/floppies	Fri Apr 27 11:29:08 2018 +0200
     2.2 +++ b/mirror/floppies/floppies	Sun Jun 24 21:59:25 2018 +0200
     2.3 @@ -7,9 +7,9 @@
     2.4  
     2.5  ds()
     2.6  {
     2.7 -	set -- $1 ${2:-512} 512
     2.8 -	dd count=$((($1*$2)/$3)) bs=$3 2>/dev/null
     2.9 -	dd count=$(((($1*$2)%$3)/$2)) bs=$2 2>/dev/null
    2.10 +	set -- $1 ${2:-512}
    2.11 +	dd count=$((($1*$2)/512)) bs=512 2>/dev/null
    2.12 +	dd count=$(((($1*$2)%512)/$2)) bs=$2 2>/dev/null
    2.13  }
    2.14  
    2.15  case "$1" in
    2.16 @@ -17,23 +17,21 @@
    2.17  	ds 1
    2.18  	ds $(($(rd 0x1F1 1)-1))
    2.19  	[ $(rd 0x229 1) -le 128 ] || ds 1
    2.20 -	[ $(rd 0x228) -ne 0 ] && ds 1 >cmdline$$
    2.21 +	[ $(rd 0x228) -ne 0 ] && ds 1 >cmd$$
    2.22  	ds $(( ($(rd 0x1F4) +31) /32)) ) >kernel
    2.23 -	if [ $(rd 0x21C) -ne 0 ]; then
    2.24 -		ds $(( ($(rd 0x21C) +3) /4)) 4 >rootfs
    2.25 -	elif [ $(rd 0x218) -ne 0 ]; then
    2.26 +	[ $(rd 0x21C) -ne 0 ] && ds $(( ($(rd 0x21C) +3) /4)) 4 >rootfs ||
    2.27 +	if [ $(rd 0x218) -ne 0 ]; then
    2.28  		n=$(($(rd 0x1EE 2)%512))
    2.29  		i=0
    2.30 +		[ $(rd $n 4 cmd$$) -eq 0 ] && ds 5000 >rootfs ||
    2.31  		while [ $(($n % 256)) -lt $(rd 0x1F0 1) ]; do
    2.32 -			ds $(( ($(rd $n 4 cmdline$$) +3) /4)) 4 >rootfs$i
    2.33 +			ds $(( ($(rd $n 4 cmd$$) +3) /4)) 4 >rootfs$i
    2.34  			n=$(($n+4))
    2.35  			i=$(($i+1))
    2.36  		done
    2.37  	fi
    2.38 -	if [ -s cmdline$$ ]; then
    2.39 -		strings <cmdline$$ | sed q >cmdline
    2.40 -		rm -f cmdline$$
    2.41 -	fi
    2.42 +	[ -s cmd$$ ] && strings <cmd$$ | sed q >cmdline
    2.43 +	rm -f cmd$$
    2.44  	;;
    2.45  *)	cat <<EOT
    2.46  usage: cat fd*.img | $0 extract  or
     3.1 --- a/mirror/floppies/mkfdrolling.sh	Fri Apr 27 11:29:08 2018 +0200
     3.2 +++ b/mirror/floppies/mkfdrolling.sh	Sun Jun 24 21:59:25 2018 +0200
     3.3 @@ -2,8 +2,10 @@
     3.4  
     3.5  WD=$(cd $(dirname $0); pwd)
     3.6  while read name iso; do
     3.7 +    [ -d $WD/$name ] || continue
     3.8      cd $WD/$name
     3.9 -    ISO=../../$iso
    3.10 +    ISO=$(ls -t ../../$iso | sed q)
    3.11 +    [ -s "$ISO" ] || continue
    3.12      if [ ! -s fd001.img ] || [ $ISO -nt fd001.img ]; then
    3.13  	rm -f fd* 2> /dev/null
    3.14  	taziso $ISO floppyset > /dev/null
    3.15 @@ -11,24 +13,34 @@
    3.16  	mnt=/mnt$$
    3.17  	mkdir $mnt
    3.18  	mount -o loop,ro $ISO $mnt
    3.19 -	mtime=$(stat -c %y $mnt/md5sum | sed 's/ .*//')
    3.20 +	mtime=$(stat -c %y $mnt/md5sum | cut -f1 -d ' ')
    3.21 +	[ $(date --help 2>&1 | sed '/^BusyB/!d;s/.* v\([^ ]*\).*/\1/;s/\./ /g'\
    3.22 +		 | awk '{ printf "%d%02d\n",$1,$2 }') -gt 126 ] &&
    3.23 +		mtime=$(LC_ALL=C date '+%d %B %Y' -d $mtime)
    3.24  	set -- $(sed '/ifmem/!d;s/.*ifmem //' $mnt/boot/isolinux/isolinux.cfg \
    3.25  		| sed 's|^|echo |;s|\([0-9][0-9]*\) |$((\1/1024))M |g' | sh)
    3.26  	umount $mnt
    3.27  	rmdir $mnt
    3.28 -	echo "Built on $mtime, needs up to ${1}b of RAM" > title
    3.29 -	n=0; x=1; while [ -n "$x" ]; do n=$(($n+2)); eval x=\$$n; done
    3.30 -	n=$((($n - 2) / 2))
    3.31 -	cat > description.html <<EOT
    3.32 +		cat > description.html <<EOT
    3.33 +<p>This floppy set uses the BIOS instead of the linux driver. You can boot
    3.34 +SliTaz using unsupported floppy drives such as some PCMCIA devices.</p>
    3.35 +EOT
    3.36 +	if [ -z "$1" ]; then
    3.37 +		echo "Built on $mtime" > title
    3.38 +	else
    3.39 +		echo "Built on $mtime, needs up to ${1}b of RAM" > title
    3.40 +		n=0; x=1; while [ -n "$x" ]; do n=$(($n+2)); eval x=\$$n; done
    3.41 +		n=$((($n - 2) / 2))
    3.42 +		cat >> description.html <<EOT
    3.43  <p>You can start with one of the $n following flavors:</p>
    3.44  
    3.45  <ul>
    3.46  EOT
    3.47 -	i=0
    3.48 -	while [ $i -lt $n ]; do
    3.49 -		eval flavor=\$$((($n - $i)*2))
    3.50 -		eval ram=\$$((($n - $i)*2 -1))
    3.51 -		cat >> description.html <<EOT
    3.52 +		i=0
    3.53 +		while [ $i -lt $n ]; do
    3.54 +			eval flavor=\$$((($n - $i)*2))
    3.55 +			eval ram=\$$((($n - $i)*2 -1))
    3.56 +			cat >> description.html <<EOT
    3.57  	<li><b>$flavor</b> needs ${ram}B of RAM and $(ls fd* | \
    3.58  		awk "/fd$(($i+1))/{q=1}{if(!q)n++}END{print n}") floppies:
    3.59  		<tt>fd001.img</tt> to <tt>$(ls -r fd${i}* | sed q)</tt>.<br>
    3.60 @@ -39,12 +51,13 @@
    3.61  gtkonly the minimum SliTaz distribution subset with GTK+ support
    3.62  core the default SliTaz distribution
    3.63  EOT
    3.64 -		).</li>
    3.65 +	).</li>
    3.66  EOT
    3.67 -		i=$(($i+1))
    3.68 -	done
    3.69 +			i=$(($i+1))
    3.70 +		done
    3.71 +		echo "</ul>" >> description.html
    3.72 +	fi
    3.73  	cat >> description.html <<EOT
    3.74 -</ul>
    3.75  
    3.76  <p>Start your computer with <tt>fd001.img</tt>. It will show the kernel version
    3.77  string and the kernel cmdline line. You can edit the cmdline. Most users can
    3.78 @@ -53,6 +66,8 @@
    3.79  <p>The floppy is then loaded into memory (one dot each 64KB) and you will be
    3.80  prompted to insert the next floppy, <tt>fd002.img</tt>. And so on up to last
    3.81  floppy.</p>
    3.82 +EOT
    3.83 +	[ -n "$1" ] && cat >> description.html <<EOT
    3.84  
    3.85  <p>You will be prompted to insert extra floppies for the next flavors.
    3.86  You can bypass this by using B to boot without loading extra floppies.</p>
    3.87 @@ -63,4 +78,5 @@
    3.88  done <<EOT
    3.89  rolling		iso/rolling/slitaz-rolling.iso
    3.90  loram-rolling	iso/rolling/slitaz-rolling-loram.iso
    3.91 +next		iso/next/slitaz-next-*.iso
    3.92  EOT
     4.1 --- a/mirror/floppies/mkindex.sh	Fri Apr 27 11:29:08 2018 +0200
     4.2 +++ b/mirror/floppies/mkindex.sh	Sun Jun 24 21:59:25 2018 +0200
     4.3 @@ -1,7 +1,7 @@
     4.4  #!/bin/sh
     4.5  
     4.6  list_version() {
     4.7 -	ls rolling ?.0 -dr | \
     4.8 +	ls rolling next ?.0 -dr | \
     4.9  	while read dir; do
    4.10  		echo $dir
    4.11  		[ -d loram-$dir ] && echo loram-$dir
    4.12 @@ -21,6 +21,7 @@
    4.13  		web*)	TYPE="&nbsp;web" ;;
    4.14  		mini*)	TYPE="&nbsp;mini" ;;
    4.15  		loram*)	TYPE="&nbsp;loram" ;;
    4.16 +		next*)	TYPE="&nbsp;next" ;;
    4.17  		*)	TYPE=""
    4.18  	esac
    4.19  	TITLE="Floppy image set"
    4.20 @@ -70,7 +71,7 @@
    4.21  list_version | \
    4.22  while read dir; do
    4.23  	case "$dir" in
    4.24 -	*-*)
    4.25 +	*-*|next)
    4.26  		echo -n "					<li>"
    4.27  		text="${dir/-/ }";;
    4.28  	*)
    4.29 @@ -83,7 +84,7 @@
    4.30  	echo "						>$text</a>"
    4.31  
    4.32  	case "$dir" in
    4.33 -	*-*)
    4.34 +	*-*|next)
    4.35  		echo "					</li>";;
    4.36  	*)
    4.37  		echo "						<ul>"
    4.38 @@ -123,9 +124,10 @@
    4.39  list_version | \
    4.40  while read dir; do
    4.41  	case "$dir" in
    4.42 -	web*)	echo -en "\n				· <a href=\"index-$dir.html\">web</a>" ;;
    4.43 -	mini*)	echo -en "\n				· <a href=\"index-$dir.html\">mini</a>" ;;
    4.44 -	loram*)	echo -en "\n				· <a href=\"index-$dir.html\">loram</a>" ;;
    4.45 +	web*)	echo -en "\n				&middot; <a href=\"index-$dir.html\">web</a>" ;;
    4.46 +	mini*)	echo -en "\n				&middot; <a href=\"index-$dir.html\">mini</a>" ;;
    4.47 +	loram*)	echo -en "\n				&middot; <a href=\"index-$dir.html\">loram</a>" ;;
    4.48 +	next*)	echo -en "\n				&middot; <a href=\"index-$dir.html\">next</a>" ;;
    4.49  	*)   	echo -en "$tail			<li><a href=\"index-$dir.html\">SliTaz $dir</a>" ;;
    4.50  	esac
    4.51  	tail="</li>\n"
    4.52 @@ -171,7 +173,7 @@
    4.53  
    4.54  <pre># dd if=fd001.img of=/dev/fd0</pre>
    4.55  
    4.56 -<p>If you have a CD-ROM, an USB port and an USB key or a network card, but you
    4.57 +<p>If you have a CD-ROM, a USB port and a USB key or a network card, but you
    4.58  can't boot these devices directly, then try <a
    4.59  href="http://mirror.slitaz.org/boot/floppy-grub4dos" target="_blank"
    4.60  >floppy-grub4dos</a> first. This 1.44Mb floppy provides tiny programs to boot
    4.61 @@ -259,24 +261,24 @@
    4.62  
    4.63  <footer>
    4.64  	<div>
    4.65 -		Copyright © <span class="year"></span>
    4.66 +		Copyright &copy; <span class="year"></span>
    4.67  		<a href="http://www.slitaz.org/">SliTaz</a>
    4.68  	</div>
    4.69  	<div>
    4.70  		Network:
    4.71 -		<a href="http://scn.slitaz.org/">Community</a> ·
    4.72 -		<a href="http://doc.slitaz.org/">Doc</a> ·
    4.73 -		<a href="http://forum.slitaz.org/">Forum</a> ·
    4.74 -		<a href="http://pkgs.slitaz.org/">Packages</a> ·
    4.75 -		<a href="http://bugs.slitaz.org">Bugs</a> ·
    4.76 +		<a href="http://scn.slitaz.org/">Community</a> &middot;
    4.77 +		<a href="http://doc.slitaz.org/">Doc</a> &middot;
    4.78 +		<a href="http://forum.slitaz.org/">Forum</a> &middot;
    4.79 +		<a href="http://pkgs.slitaz.org/">Packages</a> &middot;
    4.80 +		<a href="http://bugs.slitaz.org">Bugs</a> &middot;
    4.81  		<a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
    4.82  	</div>
    4.83  	<div>
    4.84  		SliTaz @
    4.85 -		<a href="http://twitter.com/slitaz">Twitter</a> ·
    4.86 -		<a href="http://www.facebook.com/slitaz">Facebook</a> ·
    4.87 -		<a href="http://distrowatch.com/slitaz">Distrowatch</a> ·
    4.88 -		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> ·
    4.89 +		<a href="http://twitter.com/slitaz">Twitter</a> &middot;
    4.90 +		<a href="http://www.facebook.com/slitaz">Facebook</a> &middot;
    4.91 +		<a href="http://distrowatch.com/slitaz">Distrowatch</a> &middot;
    4.92 +		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> &middot;
    4.93  		<a href="http://flattr.com/profile/slitaz">Flattr</a>
    4.94  	</div>
    4.95  	<img src="/static/qr.png" alt="#" onmouseover="this.title = location.href"