tiny-slitaz rev 0

Initial move from slitaz-pizza
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 23 19:37:38 2012 +0100 (2012-03-23)
parents
children d203aafad141
files bootloader download.php helper index.php step1.php step2.php step3.php step4.php step5.php tiny.css tinyslitaz-boot.png tinyslitaz-httpinfo.png tinyslitaz.png
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/bootloader	Fri Mar 23 19:37:38 2012 +0100
     1.3 @@ -0,0 +1,213 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# This script creates a floppy image set from a linux bzImage and can merge
     1.7 +# a cmdline and/or one or more initramfs.
     1.8 +# The total size can not exceed 15M because INT 15H function 87H limitations.
     1.9 +#
    1.10 +# (C) 2009 Pascal Bellard - GNU General Public License v3.
    1.11 +
    1.12 +usage()
    1.13 +{
    1.14 +cat <<EOT
    1.15 +Usage: $0 bzImage [--prefix image_prefix] [--cmdline 'args']
    1.16 +       [--rdev device] [--video mode] [--flags rootflags] [--tracks cnt]
    1.17 +       [--format 1440|1680|1920|2880 ] [--initrd initrdfile]...
    1.18 +
    1.19 +Default values: --format 1440 --tracks 80 --prefix floppy.
    1.20 +
    1.21 +Example:
    1.22 +$0 /boot/vmlinuz-2.6.30.6 --rdev /dev/ram0 --video -3 --cmdline 'rw lang=fr_FR kmap=fr-latin1 laptop autologin' --initrd /boot/rootfs.gz --initrd ./myconfig.gz
    1.23 +EOT
    1.24 +exit 1
    1.25 +}
    1.26 +
    1.27 +KERNEL=""
    1.28 +INITRD=""
    1.29 +CMDLINE=""
    1.30 +PREFIX="floppy."
    1.31 +FORMAT="1440"
    1.32 +RDEV=""
    1.33 +VIDEO=""
    1.34 +FLAGS=""
    1.35 +TRACKS=""
    1.36 +DEBUG=""
    1.37 +while [ -n "$1" ]; do
    1.38 +	case "$1" in
    1.39 +	--c*|-c*)  CMDLINE="$2"; shift;;
    1.40 +	--i*|-i*)  INITRD="$INITRD $2"; shift;;
    1.41 +	--p*|-p*)  PREFIX="$2"; shift;;
    1.42 +	--fo*|-f*) FORMAT="$2"; shift;;
    1.43 +	--fl*)     FLAGS="$2"; shift;;	# 1 read-only, 0 read-write
    1.44 +	--r*|-r*)  RDEV="$2"; shift;;	# /dev/???
    1.45 +	--v*|-v*)  VIDEO="$2"; shift;;	# -3 .. n
    1.46 +	--t*|-t*)  TRACKS="$2"; shift;; # likely 81 .. 84
    1.47 +	--debug)   DEBUG="1";;
    1.48 +	*) KERNEL="$1";;
    1.49 +	esac
    1.50 +	shift
    1.51 +done
    1.52 +[ -n "$KERNEL" -a -f "$KERNEL" ] || usage
    1.53 +if [ -n "$TRACKS" ]; then
    1.54 +	if [ $(( $FORMAT % $TRACKS )) -ne 0 ]; then
    1.55 +		echo "Invalid track count for format $FORMAT."
    1.56 +		usage
    1.57 +	fi
    1.58 +fi
    1.59 +
    1.60 +# write a 16 bits data
    1.61 +# usage: store16 offset data16 file
    1.62 +store16()
    1.63 +{
    1.64 +	echo $(( $2 + 0x10000 )) | \
    1.65 +		awk '{ printf "\\\\x%02X\\\\x%02X",$1%256,($1/256)%256 }' | \
    1.66 +		xargs echo -en | \
    1.67 +	dd bs=2 conv=notrunc of=$3 seek=$(( $1 / 2 )) 2> /dev/null
    1.68 +	[ -n "$DEBUG" ] && printf "store16(%04X) = %04X\n" $1 $2 1>&2
    1.69 +}
    1.70 +
    1.71 +# write a 32 bits data
    1.72 +# usage: storelong offset data32 file
    1.73 +storelong()
    1.74 +{
    1.75 +	echo $2 | awk '{ printf "\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X",
    1.76 +		 $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \
    1.77 +		xargs echo -en | \
    1.78 +		dd bs=4 conv=notrunc of=$3 seek=$(( $1 / 4 )) 2> /dev/null
    1.79 +	[ -n "$DEBUG" ] && printf "storelong(%04X) = %08X\n" $1 $2 1>&2
    1.80 +}
    1.81 +
    1.82 +# read a 32 bits data
    1.83 +# usage: getlong offset file
    1.84 +getlong()
    1.85 +{
    1.86 +	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
    1.87 +		hexdump -e '"" 1/4 "%d" "\n"'
    1.88 +}
    1.89 +
    1.90 +floppyset()
    1.91 +{
    1.92 +	# bzImage offsets
    1.93 +	CylinderCount=496
    1.94 +	SetupSzOfs=497
    1.95 +	FlagsOfs=498
    1.96 +	SyssizeOfs=500
    1.97 +	VideoModeOfs=506
    1.98 +	RootDevOfs=508
    1.99 +	CodeAdrOfs=0x214
   1.100 +	RamfsAdrOfs=0x218
   1.101 +	RamfsLenOfs=0x21C
   1.102 +	ArgPtrOfs=0x228
   1.103 +
   1.104 +	# boot+setup address
   1.105 +	SetupBase=0x90000
   1.106 +
   1.107 +	stacktop=0x9E00
   1.108 +
   1.109 +	bs=/tmp/bs$$
   1.110 +
   1.111 +	# Get and patch boot sector
   1.112 +	# See  http://hg.slitaz.org/wok/raw-file/711d076b277c/linux/stuff/linux-header-2.6.34.u
   1.113 +	dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
   1.114 +	uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null
   1.115 +begin-base64 644 -
   1.116 +/L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF
   1.117 ++D/6l1hB6DQBvgACA3QO6HYBWwseKAJ0LFNH6AoBXuhmAbAgzRCwCM0QTuhl
   1.118 +ATwIdAOIBK05NigCdPDoPgE8CnXgiHz+ieb/TBD/TBi/9AGBTRz/gMdFMACc
   1.119 +sBCxBUi0k4lEHLABiUQUmGaY0+BIZgMFZtPoaAAQB7+AACn4nHMCAccx21BW
   1.120 +6J4AXrkAgLSH/kQczRVYnXfcoRoCvxwCsQk4RBxyuJPNE+oAACCQsEYoyL7b
   1.121 +AejSAF3rI4D5E3IEOMF3a4D+AnIEOOZ3bGCB/QAGdCoGUlFTlrQCULEGtQTB
   1.122 +xQSwDyHoBJAnFEAn6IwA/s117LAgzRDitOiWAJjNE2FSUCjIdwKwAZg5+HIC
   1.123 +ifhQtALNE5VeWFpyoJVBjuGAxwJPdFFOdfSM4ZU4wXVFiMj+xrEBOOZ1O4j0
   1.124 +/sW2AID9UHIwOi7wAXIqtQBgvt4B/kQMU+gxAFvoOAB1FlKYzRO4AQLNE1rQ
   1.125 +1Dpk/nXqRgjkdeVh64sWB7AxLAO0DrsHAM0QPA1088OwDejv/6wIwHX4w79s
   1.126 +BLFbZQINuA0BZToNdArNFnT0mM0Wju9Hw1g6AEluc2VydCBkaXNrIDEuBw0A
   1.127 +AA==
   1.128 +====
   1.129 +EOT
   1.130 +
   1.131 +	# Get setup
   1.132 +	setupsz=$(getlong $SetupSzOfs $bs)
   1.133 +	setupszb=$(( $setupsz & 255 ))
   1.134 +	dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
   1.135 +
   1.136 +	if [ -n "$TRACKS" ]; then
   1.137 +		[ -n "$DEBUG" ] && echo -n "--tracks " 1>&2
   1.138 +		n=$(getlong $CylinderCount $bs)
   1.139 +		store16 $CylinderCount $(( ($n & -256) + $TRACKS )) $bs
   1.140 +	fi
   1.141 +	if [ -n "$FLAGS" ]; then
   1.142 +		[ -n "$DEBUG" ] && echo -n "--flags " 1>&2
   1.143 +		store16 $FlagsOfs $FLAGS $bs
   1.144 +	fi
   1.145 +	if [ -n "$VIDEO" ]; then
   1.146 +		[ -n "$DEBUG" ] && echo -n "--video " 1>&2
   1.147 +		store16 $VideoModeOfs $VIDEO $bs
   1.148 +	fi
   1.149 +	if [ -n "$RDEV" ]; then
   1.150 +		if [ "$(dirname $RDEV)" == "/dev" -a -b $RDEV ]; then
   1.151 +			[ -n "$DEBUG" ] && echo -n "--rdev " 1>&2
   1.152 +			RDEV=$(stat -c '0x%02t%02T' $RDEV 2> /dev/null)
   1.153 +			store16 $RootDevOfs $RDEV $bs
   1.154 +		fi
   1.155 +	fi
   1.156 +
   1.157 +	# Store cmdline after setup
   1.158 +	if [ -n "$CMDLINE" ]; then
   1.159 +		[ -n "$DEBUG" ] && echo -n "--cmdline '$CMDLINE' " 1>&2
   1.160 +		echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
   1.161 +		storelong $ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
   1.162 +	fi
   1.163 +
   1.164 +	# Compute initramfs size
   1.165 +	initrdlen=0
   1.166 +	for i in $( echo $INITRD | sed 's/,/ /' ); do
   1.167 +		[ -s "$i" ] || continue
   1.168 +		[ -n "$DEBUG" ] && echo "--initrd $i " 1>&2
   1.169 +		initrdlen=$(( ($initrdlen + $(stat -c %s $i) + 3) & -4 ))
   1.170 +	done
   1.171 +	if [ $initrdlen -ne 0 ]; then
   1.172 +		[ -n "$DEBUG" ] && echo "initrdlen = $initrdlen " 1>&2
   1.173 +		storelong $RamfsAdrOfs \
   1.174 +			$(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
   1.175 +		storelong $RamfsLenOfs $initrdlen $bs
   1.176 +	fi
   1.177 +
   1.178 +	# Output boot sector + setup + cmdline
   1.179 +	dd if=$bs 2> /dev/null
   1.180 +
   1.181 +	# Output kernel code
   1.182 +	dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
   1.183 +
   1.184 +	# Pad to next sector
   1.185 +	Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
   1.186 +	[ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
   1.187 +
   1.188 +	# Output initramfs
   1.189 +	padding=0
   1.190 +	for i in $( echo $INITRD | sed 's/,/ /' ); do
   1.191 +		[ -s "$i" ] || continue
   1.192 +		[ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding 2> /dev/null
   1.193 +		dd if=$i 2> /dev/null
   1.194 +		padding=$(( 4 - ($(stat -c %s $i) & 3) ))
   1.195 +		[ $padding -eq 4 ] && padding=0
   1.196 +	done
   1.197 +
   1.198 +	# Cleanup
   1.199 +	rm -f $bs
   1.200 +}
   1.201 +
   1.202 +if [ "$FORMAT" == "0" ]; then # unsplitted
   1.203 +	floppyset > $PREFIX
   1.204 +	PAD=$(( 512 - ($(stat -c %s $PREFIX) % 512) ))
   1.205 +	[ $PAD -ne 512 ] && dd if=/dev/zero bs=1 count=$PAD >> $PREFIX 2> /dev/null
   1.206 +	exit
   1.207 +fi
   1.208 +floppyset | split -b ${FORMAT}k /dev/stdin floppy$$
   1.209 +i=1
   1.210 +ls floppy$$* | while read file ; do
   1.211 +	output=$PREFIX$(printf "%03d" $i)
   1.212 +	cat $file /dev/zero | dd bs=1k count=$FORMAT conv=sync of=$output 2> /dev/null
   1.213 +	echo $output
   1.214 +	rm -f $file
   1.215 +	i=$(( $i + 1 ))
   1.216 +done
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/download.php	Fri Mar 23 19:37:38 2012 +0100
     2.3 @@ -0,0 +1,38 @@
     2.4 +<?php
     2.5 +
     2.6 +function download($file,$name='')
     2.7 +{
     2.8 +	if ($name == '')
     2.9 +		$name = basename($file);
    2.10 +	if (isset($_POST['tmp_dir']))
    2.11 +		$file = $_POST['tmp_dir'].$file;
    2.12 +	$cmd = "cat ".$file;
    2.13 +	$size = filesize($file);
    2.14 +	header("Content-Type: application/octet-stream");
    2.15 +	header("Content-Length: ".$size);
    2.16 +	header("Content-Disposition: attachment; filename=".$name);
    2.17 +	print `$cmd`;
    2.18 +	exit;
    2.19 +}
    2.20 +
    2.21 +if (isset($_POST['download'])) {
    2.22 +	switch (substr($_POST['download'],0,6)) {
    2.23 +	case "Kernel" : download("fs/boot/bzImage","kernel");
    2.24 +	case "Rootfs" : download("rootfs.gz");
    2.25 +	case "packag" : download("fs/etc/packages.conf");
    2.26 +	case "Config" : shell_exec("sudo ./helper --mkcfg ".$_POST['tmp_dir']); 
    2.27 +			download("config_files.cpio.gz");
    2.28 +	case "Floppy" : shell_exec("./helper --mkimg ".$_POST['tmp_dir']); 
    2.29 +			download("slitaz.img");
    2.30 +	case "ISO im" : shell_exec("sudo ./helper --mkiso ".$_POST['tmp_dir']); 
    2.31 +			download("slitaz.iso");
    2.32 +	case "System" : download("fs/boot/System.map");
    2.33 +	case "linux." : download("fs/boot/config","linux.config");
    2.34 +	case "busybo" : download("fs/boot/config-busybox","busybox.config");
    2.35 +	case "post_i" : download("post_install.log");
    2.36 +	}
    2.37 +}
    2.38 +if (isset($_GET['dl'])) {
    2.39 +	download(shell_exec("./helper --get-pkg ".$_GET['dl']." ".$_GET['tmp'])); 
    2.40 +}
    2.41 +?>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/helper	Fri Mar 23 19:37:38 2012 +0100
     3.3 @@ -0,0 +1,358 @@
     3.4 +#!/bin/sh
     3.5 +# $0 kernel size [initrd]
     3.6 +
     3.7 +list_pkgs()
     3.8 +{
     3.9 +	TMPDIR=$2
    3.10 +	shift 2
    3.11 +	cat <<EOT
    3.12 +<table>
    3.13 +<tr>
    3.14 +<th></th>
    3.15 +<th>Package</th>
    3.16 +<th>Version</th>
    3.17 +<th>Description</th>
    3.18 +<th>Disk</th>
    3.19 +<th>Memory</th>
    3.20 +<th></th>
    3.21 +</tr>
    3.22 +EOT
    3.23 +	for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt ; do
    3.24 +		[ -s $i ] || continue
    3.25 +		case "$i" in
    3.26 +		pkgs/kernel-*/receipt) continue;;
    3.27 +		pkgs/module-*/receipt) continue;;
    3.28 +		esac
    3.29 +		AUTO_SELECTION=""
    3.30 +		UNPACKED_SIZE="-"
    3.31 +		PACKED_SIZE="-"
    3.32 +		checked=""
    3.33 +		. $i
    3.34 +		case " $@ " in
    3.35 +		*\ $PACKAGE\ *)	checked='checked="checked"';;
    3.36 +		*) [ -n "$2" ] && checked="";;
    3.37 +		esac
    3.38 +		grep -qs "^$PACKAGE " $TMPDIR/uploadconf &&
    3.39 +			checked='checked="checked"'
    3.40 +		if [ -n "$AUTO_SELECTION" ]; then
    3.41 +			checked='checked="checked" disabled'
    3.42 +			cat <<EOT
    3.43 +<input type="hidden" name="selected[]" value="$PACKAGE" />
    3.44 +EOT
    3.45 +		fi
    3.46 +		cat <<EOT
    3.47 +<tr>
    3.48 +<td><input type="checkbox" name="selected[]" value="$PACKAGE" $checked /></td>
    3.49 +<td><a href="?dl=$PACKAGE-$VERSION&amp;tmp=$TMPDIR">$PACKAGE</a></td>
    3.50 +<td>$VERSION</td>
    3.51 +<td>$SHORT_DESC</td>
    3.52 +<td>$PACKED_SIZE</td>
    3.53 +<td>$UNPACKED_SIZE</td>
    3.54 +<td>$(grep -qs ^config_form $i && echo '&raquo;')</td>
    3.55 +</tr>
    3.56 +EOT
    3.57 +	done
    3.58 +	cat <<EOT
    3.59 +</table>
    3.60 +<p>
    3.61 +</p>
    3.62 +EOT
    3.63 +	exit
    3.64 +}
    3.65 +
    3.66 +list_kernels()
    3.67 +{
    3.68 +	TMPDIR=$2
    3.69 +	shift 2
    3.70 +	cat <<EOT
    3.71 +<table>
    3.72 +<tr>
    3.73 +<th></th>
    3.74 +<th>Kernel</th>
    3.75 +<th>Version</th>
    3.76 +<th>Description</th>
    3.77 +<!-- th>Size</th -->
    3.78 +</tr>
    3.79 +EOT
    3.80 +	checked='checked="checked"'
    3.81 +	for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt ; do
    3.82 +		[ -s $i ] || continue
    3.83 +		case "$i" in
    3.84 +		pkgs/kernel-*/receipt);;
    3.85 +		*) continue;;
    3.86 +		esac
    3.87 +		UNPACKED_SIZE="-"
    3.88 +		. $i
    3.89 +		case " $@ " in
    3.90 +		*\ $PACKAGE\ *)	checked='checked="checked"' ;;
    3.91 +		*) [ -n "$2" ] && checked="";;
    3.92 +		esac
    3.93 +		cat <<EOT
    3.94 +<tr>
    3.95 +<td><input type="radio" name="kernel" value="$PACKAGE" $checked/></td>
    3.96 +<td>${PACKAGE#kernel-}</td>
    3.97 +<td>$VERSION</td>
    3.98 +<td>$SHORT_DESC</td>
    3.99 +<!-- td>$UNPACKED_SIZE</td -->
   3.100 +</tr>
   3.101 +EOT
   3.102 +		checked=""
   3.103 +	done
   3.104 +	cat <<EOT
   3.105 +</table>
   3.106 +EOT
   3.107 +	exit
   3.108 +}
   3.109 +
   3.110 +list_modules()
   3.111 +{
   3.112 +	TMPDIR=$2
   3.113 +	shift 2
   3.114 +	cat <<EOT
   3.115 +<table>
   3.116 +<tr>
   3.117 +<th></th>
   3.118 +<th>Module</th>
   3.119 +<th>Version</th>
   3.120 +<th>Description</th>
   3.121 +<th>Size</th>
   3.122 +<th></th>
   3.123 +</tr>
   3.124 +EOT
   3.125 +	for i in $TMPDIR/pkgs/*/receipt pkgs/*/receipt ; do
   3.126 +		[ -s $i ] || continue
   3.127 +		case "$i" in
   3.128 +		pkgs/module-*/receipt);;
   3.129 +		*) continue;;
   3.130 +		esac
   3.131 +		UNPACKED_SIZE="-"
   3.132 +		. $i
   3.133 +		checked=""
   3.134 +		case " $@ " in
   3.135 +		*\ $PACKAGE\ *)	checked='checked="checked"' ;;
   3.136 +		esac
   3.137 +		grep -qs "^$PACKAGE " $TMPDIR/uploadconf &&
   3.138 +			checked='checked="checked"'
   3.139 +		cat <<EOT
   3.140 +<tr>
   3.141 +<td><input type="checkbox" name="selected[]" value="$PACKAGE" $checked/></td>
   3.142 +<td>${PACKAGE#module-}</td>
   3.143 +<td>$VERSION</td>
   3.144 +<td>$SHORT_DESC</td>
   3.145 +<td>$UNPACKED_SIZE</td>
   3.146 +<td>$(grep -qs ^config_form $i && echo '?')</td>
   3.147 +</tr>
   3.148 +EOT
   3.149 +	done
   3.150 +	cat <<EOT
   3.151 +</table>
   3.152 +EOT
   3.153 +	exit
   3.154 +}
   3.155 +
   3.156 +get_receipt()
   3.157 +{
   3.158 +	grep -l "PACKAGE=\"$1\"" $2/pkgs/*/receipt pkgs/*/receipt | head -1
   3.159 +}
   3.160 +
   3.161 +get_package()
   3.162 +{
   3.163 +	local pkg
   3.164 +	pkg=pkgs/$1/receipt
   3.165 +	[ -s $pkg ] || pkg=$2/pkgs/$1/receipt
   3.166 +	[ -s $pkg ] || pkg=$(get_receipt $@)
   3.167 +	. $pkg
   3.168 +	cd $(dirname $pkg)
   3.169 +	pkg=$2$PACKAGE-$VERSION.tazpkg
   3.170 +	find * | cpio -o -H newc > $pkg
   3.171 +	echo -n $pkg
   3.172 +}
   3.173 +
   3.174 +get_note()
   3.175 +{
   3.176 +	pkg=$(get_receipt $1 $2)
   3.177 +	[ -n "$pkg" ] || exit
   3.178 +	grep -qs ^config_note $pkg || exit
   3.179 +	. $pkg
   3.180 +	config_note
   3.181 +}
   3.182 +
   3.183 +get_form()
   3.184 +{
   3.185 +	pkg=$(get_receipt $1 $2)
   3.186 +	[ -n "$pkg" ] || exit
   3.187 +	grep -qs ^config_form $pkg || exit
   3.188 +	. $pkg
   3.189 +	if [ -s $2/uploadconf ]; then
   3.190 +		awk "{
   3.191 +if (found) {
   3.192 +	if (/^ /) print;
   3.193 +	else exit;
   3.194 +}
   3.195 +if (/^$PACKAGE /) found=1
   3.196 +}" < $2/uploadconf | sed -e 's/  //' -e 's/  \([A-Z_0-9]*=\)/export \1/' > $2/vars
   3.197 +		. $2/vars
   3.198 +	fi
   3.199 +	config_form $2/fs
   3.200 +	exit
   3.201 +}
   3.202 +
   3.203 +do_pre_install()
   3.204 +{
   3.205 +	pkg=$(get_receipt $1 $2)
   3.206 +	[ -n "$pkg" ] || exit
   3.207 +	CONFIG_FILES=""
   3.208 +	. $pkg
   3.209 +	grep -qs ^pre_install $pkg && pre_install $2/fs
   3.210 +	[ -n "$CONFIG_FILES" ] && for i in $CONFIG_FILES; do echo $i >> $2/config_files; done
   3.211 +	unlzma -c $(dirname $pkg)/fs.cpio.lzma | ( cd $2 ; cpio -idmu )
   3.212 +	exit 
   3.213 +}
   3.214 +
   3.215 +do_post_install()
   3.216 +{
   3.217 +	pkg=$(get_receipt $1 $2)
   3.218 +	[ -n "$pkg" ] || exit
   3.219 +	. $pkg
   3.220 +	echo "$1 $VERSION $(md5sum $(dirname $pkg)/fs.cpio.lzma | awk '{ print $1 }')" >> $2/fs/etc/packages.conf
   3.221 +	if grep -qs ^post_install $pkg; then
   3.222 +		. $2/vars
   3.223 +		echo "=== $pkg: $(date) ===" >> $2/post_install.log 2>&1
   3.224 +		post_install $2/fs >> $2/post_install.log 2>&1
   3.225 +		sed -e 's/^export/ /' -e 's/^/  /' < $2/vars >> $2/fs/etc/packages.conf
   3.226 +	fi
   3.227 +	rm -f $2/vars
   3.228 +	exit 
   3.229 +}
   3.230 +
   3.231 +scan_depends()
   3.232 +{
   3.233 +	local pkg
   3.234 +	for pkg in $@ ; do
   3.235 +		case " $OUTPUT " in
   3.236 +		*\ $pkg\ *) continue ;;
   3.237 +		esac
   3.238 +		DEPENDS=""
   3.239 +		. $(get_receipt $pkg $TMPDIR)
   3.240 +		scan_depends $DEPENDS
   3.241 +		case " $OUTPUT " in
   3.242 +		*\ $pkg\ *) continue ;;
   3.243 +		esac
   3.244 +		OUTPUT="$OUTPUT $pkg"
   3.245 +	done
   3.246 +}
   3.247 +
   3.248 +get_depends()
   3.249 +{
   3.250 +	TMPDIR=$2
   3.251 +	shift 2
   3.252 +	OUTPUT=""
   3.253 +	scan_depends $@
   3.254 +	echo -n $OUTPUT
   3.255 +	exit
   3.256 +}
   3.257 +
   3.258 +pkgs_extract()
   3.259 +{
   3.260 +	cd $2
   3.261 +	mkdir pkgs
   3.262 +	if cpio -t < $1 | grep -q receipt; then
   3.263 +		mv $1 pkgs
   3.264 +	elif tar tf $1 | grep -q tazpkg; then
   3.265 +		tar xf $1 -C pkgs
   3.266 +	elif tar tzf $1 | grep -q tazpkg; then
   3.267 +		tar xzf $1 -C pkgs
   3.268 +	elif tar tjf $1 | grep -q tazpkg; then
   3.269 +		tar xjf $1 -C pkgs
   3.270 +	else
   3.271 +		rm -rf $1 pkgs
   3.272 +		exit
   3.273 +	fi
   3.274 +	cd pkgs
   3.275 +	for i in *; do
   3.276 +		mkdir tmp
   3.277 +		cd tmp
   3.278 +		cpio -i < ../$i
   3.279 +		. ./receipt
   3.280 +		cd ..
   3.281 +		mv tmp $PACKAGE-$VERSION
   3.282 +	done
   3.283 +	exit
   3.284 +}
   3.285 +
   3.286 +lzma_set_size()
   3.287 +{
   3.288 +	n=$(unlzma -c $1 | wc -c)
   3.289 +	for i in $(seq 1 8); do
   3.290 +		printf '\\\\x%02X' $(($n & 255))
   3.291 +		n=$(($n >> 8))
   3.292 +	done | xargs echo -en | dd of=$1 conv=notrunc bs=1 seek=5 2> /dev/null
   3.293 +}
   3.294 +
   3.295 +case "$1" in
   3.296 +--list-modules) list_modules $@ ;;
   3.297 +--list-kernels) list_kernels $@ ;;
   3.298 +--list-pkgs) list_pkgs $@ ;;
   3.299 +--get-form) get_form $2 $3 ;;
   3.300 +--get-note) get_note $2 $3 ;;
   3.301 +--pre-install) do_pre_install $2 $3 ;;
   3.302 +--post-install) do_post_install $2 $3 ;;
   3.303 +--depends) get_depends $@ ;;
   3.304 +--pkgs-extract) pkgs_extract $2 $3 ;;
   3.305 +--remove) rm -rf $2; exit ;;
   3.306 +--get-pkg) get_package $2 $3 ;;
   3.307 +esac
   3.308 +
   3.309 +if [ "x$1" == "x--mkrootfs" ]; then
   3.310 +	tmp=$2
   3.311 +	cd $tmp/fs
   3.312 +	if [ ! -d boot -a -s ../kernel ]; then # custom kernel
   3.313 +		mkdir boot
   3.314 +		cp ../kernel boot/bzImage
   3.315 +	fi
   3.316 +	find -user bellard -exec chown root.root {} \;
   3.317 +	find | grep -v ^./boot | cpio -o -H newc | lzma e ../rootfs.gz -si
   3.318 +	lzma_set_size ../rootfs.gz
   3.319 +fi
   3.320 +if [ "x$1" == "x--mkiso" ]; then
   3.321 +	tmp=$2
   3.322 +	mkdir -p $tmp/iso/boot/isolinux $tmp/iso/data
   3.323 +	cat $tmp/fs/boot/System.map | gzip -9 > $tmp/iso/data/sysmap.gz
   3.324 +	cat $tmp/fs/boot/config | gzip -9 > $tmp/iso/data/linconf.gz
   3.325 +	cat $tmp/fs/boot/config-busybox | gzip -9 > $tmp/iso/data/bbconf.gz
   3.326 +	cp $tmp/config_files $tmp/iso/data/files.cnf
   3.327 +	cp $tmp/fs/etc/packages.conf $tmp/iso/data/packages.cnf
   3.328 +	cp $tmp/fs/boot/bzImage $tmp/iso/boot/bzImage
   3.329 +	cp $tmp/rootfs.gz $tmp/iso/boot/rootfs
   3.330 +	cp /boot/isolinux/isolinux.bin $tmp/iso/boot/isolinux
   3.331 +	cat > $tmp/iso/boot/isolinux/isolinux.cfg <<EOT
   3.332 +label slitaz
   3.333 +	kernel /boot/bzImage
   3.334 +	append initrd=/boot/rootfs rw root=/dev/null vga=normal
   3.335 +default slitaz
   3.336 +implicit 0	
   3.337 +prompt 1	
   3.338 +timeout 50
   3.339 +EOT
   3.340 +	genisoimage -o $tmp/slitaz.iso -b boot/isolinux/isolinux.bin \
   3.341 +                -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
   3.342 +                -V "Tiny SliTaz" -p "www.slitaz.org" -input-charset iso8859-1 \
   3.343 +                -boot-info-table $tmp/iso > /dev/null 2>&1
   3.344 +        [ -x /usr/bin/isohybrid ] &&
   3.345 +        /usr/bin/isohybrid $tmp/slitaz.iso 2> /dev/null
   3.346 +fi
   3.347 +if [ "x$1" == "x--mkimg" ]; then
   3.348 +	tmp=$2
   3.349 +	exe=$PWD
   3.350 +	cd $tmp
   3.351 +	$exe/bootloader fs/boot/bzImage --initrd rootfs.gz --format 0
   3.352 +	mv floppy. slitaz.img
   3.353 +#	$exe/bootloader fs/boot/bzImage --initrd rootfs.gz
   3.354 +#	cat floppy.* > slitaz.img && rm -f floppy.*
   3.355 +fi
   3.356 +if [ "x$1" == "x--mkcfg" ]; then
   3.357 +	tmp=$2
   3.358 +	cd $tmp/fs
   3.359 +	for i in $(sed 's#^/##' < ../config_files); do find $i; done | \
   3.360 +		sort | uniq | cpio -o -H newc | gzip -9 > ../config_files.cpio.gz
   3.361 +fi
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/index.php	Fri Mar 23 19:37:38 2012 +0100
     4.3 @@ -0,0 +1,132 @@
     4.4 +<?php
     4.5 +include "download.php";
     4.6 +$static = "http://mirror.slitaz.org/static/";
     4.7 +?>
     4.8 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     4.9 +	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    4.10 +<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
    4.11 +<head>
    4.12 +	<title>Tiny SliTaz - Builder</title>
    4.13 +	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
    4.14 +	<meta name="description" content="Tiny SliTaz Linux" />
    4.15 +	<meta name="keywords" lang="en" content="tiny slitaz, uclibx, tcc" />
    4.16 +	<meta name="robots" content="index, follow, all" />
    4.17 +	<meta name="revisit-after" content="7 days" />
    4.18 +	<meta name="expires" content="never" />
    4.19 +	<meta name="modified" content="<?php echo (date( "Y-m-d H:i:s", getlastmod())); ?>" />
    4.20 +	<meta name="author" content="SliTaz Contributors" />
    4.21 +	<meta name="publisher" content="www.slitaz.org" />
    4.22 +	<link rel="shortcut icon" href="<?php echo "$static"; ?>favicon.ico" />
    4.23 +	<link rel="stylesheet" type="text/css" href="<?php echo "$static"; ?>slitaz.css" />
    4.24 +	<link rel="stylesheet" type="text/css" href="tiny.css" />
    4.25 +</head>
    4.26 +<body>
    4.27 +
    4.28 +<!-- Header -->
    4.29 +<div id="header">
    4.30 +	<a name="top"></a>
    4.31 +	<div id="logo"></div>
    4.32 +	<div id="network">
    4.33 +		<a href="http://www.slitaz.org/">
    4.34 +		<img src="<?php echo "$static"; ?>/home.png" alt="[ Home ]" /></a>
    4.35 +		<!-- Get static files from Mirror Files vhost -->
    4.36 +		<!-- <img src="http://mf.slitaz.org/images/people.png" alt="[ Group ]" /> -->
    4.37 +		Tiny:
    4.38 +		<a href="http://scn.slitaz.org/groups/tiny">Group</a>
    4.39 +		<a href="http://forum.slitaz.org/forum/tiny">Forum</a>
    4.40 +		Screenshots:
    4.41 +		<a href="tinyslitaz.png" title="Tiny SliTaz Manager">main</a>
    4.42 +		<a href="tinyslitaz-boot.png" title="Tiny SliTaz Manager: boot.log">boot log</a>
    4.43 +		<a href="tinyslitaz-httpinfo.png" title="Tiny SliTaz Manager: httpd info">httpd info</a>
    4.44 +	</div>
    4.45 +	<h1><a href="http://tiny.slitaz.org/">Tiny SliTaz</a></h1>
    4.46 +</div>
    4.47 +
    4.48 +
    4.49 +<!-- Content -->
    4.50 +<div id="content">
    4.51 +
    4.52 +<?php if (isset($error) && $error != "") echo "
    4.53 +<div class=\"nav_box\">
    4.54 +	<h4>Error :</h4>
    4.55 +	<p>$error</p>
    4.56 +</div>
    4.57 +"; ?>
    4.58 +
    4.59 +<h2>Build your configuration from binary packages</h2>
    4.60 +
    4.61 +<?php
    4.62 +include "step1.php";
    4.63 +include "step2.php";
    4.64 +include "step3.php";
    4.65 +include "step4.php";
    4.66 +include "step5.php";
    4.67 +?>
    4.68 +
    4.69 +
    4.70 +<div class="box">
    4.71 +<h4>Tiny SliTaz goals</h4>
    4.72 +<p>
    4.73 +	Useful software, expansible, easy to configure, runs fully in RAM, 
    4.74 +	simple, light and fast for minimum hardware resources: ie fits on
    4.75 +	one floppy disk (IDE disk optional), runs on a 386sx processor and
    4.76 +	needs as little memory as possible (currently 8 MB with a 2.6.34 
    4.77 +	kernel).
    4.78 +	<a href="http://doc.slitaz.org/en:guides:pxe#why-use-pxe-the-vnc-example">
    4.79 +	Example</a>
    4.80 +</p>
    4.81 +</div>
    4.82 +
    4.83 +<div class="box">
    4.84 +<h4>Why this builder ?</h4>
    4.85 +<p>
    4.86 +	Tiny SliTaz should be as small as possible. Only the necessary
    4.87 +	software is kept. The package manager is run using this website.
    4.88 +</p>
    4.89 +</div>
    4.90 +
    4.91 +<div class="box">
    4.92 +<h4>How is it built ?</h4>
    4.93 +<p>
    4.94 +	Tiny SliTaz uses a Linux kernel
    4.95 +	with an <a href="dist/rootfs.cpio" title="See CONFIG_INITRAMFS_SOURCE">
    4.96 +	embedded filesystem</a>. An extra initramfs can also be loaded with 
    4.97 +	the configuration and extra packages.
    4.98 +</p>
    4.99 +<p>
   4.100 +	The initramfs is based on <a href="http://uclibc.org/"
   4.101 +	title="Instead of glibc">uClibc</a> and 
   4.102 +	busybox with its <a href="dist/busybox.config.txt">config</a>
   4.103 +	files and the packages 
   4.104 +	<a href="http://pkgs.slitaz.org/search.cgi?filelist=slitaz-base-files">
   4.105 +	slitaz-base-files</a> and 
   4.106 +	<a href="http://pkgs.slitaz.org/search.cgi?filelist=slitaz-boot-scripts">
   4.107 +	slitaz-boot-scripts</a>.
   4.108 +</p>
   4.109 +</div>
   4.110 +
   4.111 +<!-- End of content -->
   4.112 +</div>
   4.113 +
   4.114 +<!-- Footer -->
   4.115 +<div id="footer">
   4.116 +	Copyright &copy; <span class="year"></span>
   4.117 +	<a href="http://www.slitaz.org/">SliTaz</a> - Network:
   4.118 +	<a href="http://scn.slitaz.org/">Community</a>
   4.119 +	<a href="http://doc.slitaz.org/">Doc</a>
   4.120 +	<a href="http://forum.slitaz.org/">Forum</a>
   4.121 +	<a href="http://pkgs.slitaz.org/">Packages</a>
   4.122 +	<a href="http://bugs.slitaz.org">Bugs</a>
   4.123 +	<a href="http://hg.slitaz.org/">Hg</a>
   4.124 +	<p>
   4.125 +		SliTaz @
   4.126 +		<a href="http://twitter.com/slitaz">Twitter</a>
   4.127 +		<a href="http://www.facebook.com/slitaz">Facebook</a>
   4.128 +		<a href="http://distrowatch.com/slitaz">Distrowatch</a>
   4.129 +		<a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
   4.130 +		<a href="http://flattr.com/profile/slitaz">Flattr</a>
   4.131 +	</p>
   4.132 +</div>
   4.133 +
   4.134 +</body>
   4.135 +</html>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/step1.php	Fri Mar 23 19:37:38 2012 +0100
     5.3 @@ -0,0 +1,136 @@
     5.4 +<?php 
     5.5 +
     5.6 +$usedvars = array( "kernel", "modules", "packages", "toconfigure",
     5.7 +	"continue", "configuring", "tmp_dir" );
     5.8 +
     5.9 +function set_tmp_dir()
    5.10 +{
    5.11 +	$dir = opendir("/tmp");
    5.12 +	while (($name = readdir($dir)) !== false) {
    5.13 +		if (preg_match('/^tiny_webgen/',$name) == 0) continue;
    5.14 +		if (filemtime("/tmp/$name") > strtotime("-1 hour")) continue;
    5.15 +		shell_exec("sudo ./helper --remove /tmp/$name"); 
    5.16 +	}
    5.17 +	closedir($dir);
    5.18 +	if (isset($_POST["tmp_dir"])) return;
    5.19 +	$_POST["tmp_dir"] = tempnam('','tiny_webgen');
    5.20 +	if (file_exists($_POST["tmp_dir"])) unlink($_POST["tmp_dir"]);
    5.21 +	mkdir($_POST["tmp_dir"]);
    5.22 +	$_POST["tmp_dir"] .= '/';
    5.23 +}
    5.24 +
    5.25 +set_tmp_dir();
    5.26 +
    5.27 +function post_hidden()
    5.28 +{
    5.29 +	global $usedvars;
    5.30 +	foreach ($usedvars as $var) {
    5.31 +		if (isset($_POST[$var]) && $var != "continue" && 
    5.32 +		    $var != "configuring") {
    5.33 +?>
    5.34 +<input name="<?php echo $var; ?>" value="<?php echo $_POST[$var]; ?>" type="hidden" />
    5.35 +<?php
    5.36 +		 }
    5.37 +	 }
    5.38 +}
    5.39 +
    5.40 +function upload($var, $file = "")
    5.41 +{
    5.42 +	if ($file == "") $file = $var;
    5.43 +	if (isset($_FILES[$var])) {
    5.44 +		$tmp_name = $_FILES[$var]['tmp_name'];
    5.45 +		if (is_uploaded_file($tmp_name)) {
    5.46 +			move_uploaded_file($tmp_name, $_POST["tmp_dir"].$file);
    5.47 +		}
    5.48 +	}
    5.49 +}
    5.50 +
    5.51 +if (isset($_POST['mykernel']) && !isset($_POST['packages'])) {
    5.52 +        $_POST['kernel'] = "custom";
    5.53 +	upload("uploadkernel","kernel");
    5.54 +}
    5.55 +
    5.56 +if (!isset($_POST['kernel'])) {
    5.57 +	if (isset($_POST['config'])) {
    5.58 +		upload("uploadconf");
    5.59 +	}
    5.60 +	if (!file_exists($_POST["tmp_dir"]."uploadconf")) {
    5.61 +?>
    5.62 +
    5.63 +<p>
    5.64 +The file <u>/etc/packages.conf</u> in the initramfs holds all information
    5.65 +to rebuild your Tiny SliTaz system. You should upload your 
    5.66 +<u>/etc/packages.conf</u> first if you want to upgrade your system only.
    5.67 +</p>
    5.68 +
    5.69 +<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
    5.70 +Packages configuration:
    5.71 +<input type="file" name="uploadconf" />
    5.72 +<input name="config" value="Get config" type="submit" />
    5.73 +<?php post_hidden(); ?>
    5.74 +</form>
    5.75 +<?php
    5.76 +	}
    5.77 +	if (isset($_POST['mypackages'])) {
    5.78 +		upload("uploadpkgs");
    5.79 +		shell_exec("./helper --pkgs-extract uploadpkgs ".$_POST['tmp_dir']); 
    5.80 +	}
    5.81 +	if (!file_exists($_POST["tmp_dir"]."uploadpkgs")) {
    5.82 +?>
    5.83 +
    5.84 +<p>
    5.85 +You can upload a tazpkg file (.tazpkg) or a tarball of tazpkg files (.tar).
    5.86 +These packages will extend the official packages list and will be chosen when
    5.87 +the package names are found to be matching. You can find some examples in the
    5.88 +<a href="http://hg.slitaz.org/wok-tiny/file/">Tiny SliTaz repository</a>.
    5.89 +</p>
    5.90 +<div>
    5.91 +<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
    5.92 +Additional packages:
    5.93 +<input type="file" name="uploadpkgs" />
    5.94 +<input name="mypackages" value="Get packages" type="submit" />
    5.95 +<?php post_hidden(); ?>
    5.96 +</form>
    5.97 +</div>
    5.98 +<p>
    5.99 +<?php
   5.100 +	}
   5.101 +?>
   5.102 +</p>
   5.103 +
   5.104 +<a name="kernel"></a>
   5.105 +<h2>Linux kernel</h2>
   5.106 +
   5.107 +<p>
   5.108 +You can upload a custom kernel or use an official one.
   5.109 +Your kernel should have an embedded initramfs with busybox like 
   5.110 +<a href="dist/rootfs.cpio" title="See CONFIG_INITRAMFS_SOURCE">this one</a>.
   5.111 +</p>
   5.112 +
   5.113 +<div>
   5.114 +<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
   5.115 +Custom kernel (bzImage file):
   5.116 +<input type="file" name="uploadkernel" />
   5.117 +<input name="mykernel" value="Get kernel" type="submit" />
   5.118 +<?php post_hidden(); ?>
   5.119 +</form>
   5.120 +</div>
   5.121 +
   5.122 +<div>
   5.123 +<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="kernels">
   5.124 +<?php
   5.125 +	echo shell_exec("./helper --list-kernels ".$_POST["tmp_dir"]);
   5.126 +	post_hidden();
   5.127 +?>
   5.128 +<p>
   5.129 +</p>
   5.130 +
   5.131 +<div align="center">
   5.132 +<input name="continue" value="Continue" type="submit" />
   5.133 +</div>
   5.134 +</form>
   5.135 +</div>
   5.136 +<?php
   5.137 +}
   5.138 +?>
   5.139 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/step2.php	Fri Mar 23 19:37:38 2012 +0100
     6.3 @@ -0,0 +1,36 @@
     6.4 +<?php
     6.5 +
     6.6 +if (isset($_POST['kernel']) && $_POST['kernel'] == "kernel-modular" &&
     6.7 +   !isset($_POST['modules'])) {
     6.8 +	if (isset($_POST['selected'])) {
     6.9 +		$_POST['modules'] = implode(" ",$_POST['selected']);
    6.10 +		unset($_POST['selected']);
    6.11 +	}
    6.12 +}
    6.13 +
    6.14 +if (isset($_POST['kernel']) && $_POST['kernel'] == "kernel-modular" &&
    6.15 +   !isset($_POST['modules'])) {
    6.16 +
    6.17 +?>
    6.18 +
    6.19 +<a name="modules"></a>
    6.20 +<h2>Additionnal modules</h2>
    6.21 +
    6.22 +<form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="packages">
    6.23 +
    6.24 +<?php
    6.25 +	echo shell_exec("./helper --list-modules ".$_POST["tmp_dir"]);
    6.26 +	post_hidden();
    6.27 +?>
    6.28 +<p>
    6.29 +</p>
    6.30 +
    6.31 +<div align="center">
    6.32 +<input name="continue" value="Continue" type="submit" />
    6.33 +</div>
    6.34 +
    6.35 +</form>
    6.36 +
    6.37 +<?php
    6.38 +}
    6.39 +?>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/step3.php	Fri Mar 23 19:37:38 2012 +0100
     7.3 @@ -0,0 +1,48 @@
     7.4 +<?php
     7.5 +
     7.6 +if (isset($_POST['kernel']) && 
     7.7 +   ($_POST['kernel'] != "kernel-modular" || isset($_POST['modules'])) &&
     7.8 +   !isset($_POST['packages'])) {
     7.9 +	if (isset($_POST['selected'])) {
    7.10 +		upload("mypackages");
    7.11 +		$last = count($_POST['selected'])-1;
    7.12 +		if ($_POST['selected'][$last] == "uploaded") {
    7.13 +			unset($_POST['selected'][$last]);
    7.14 +		}
    7.15 +		$_POST['packages'] = implode(" ",$_POST['selected']);
    7.16 +		unset($_POST['selected']);
    7.17 +	}
    7.18 +}
    7.19 +
    7.20 +if (isset($_POST['kernel']) && 
    7.21 +   ($_POST['kernel'] != "kernel-modular" || isset($_POST['modules'])) &&
    7.22 +   !isset($_POST['packages'])) {
    7.23 +
    7.24 +	mkdir($_POST["tmp_dir"]."/fs");
    7.25 +	if ($_POST['kernel'] != "custom") {
    7.26 +		shell_exec("sudo ./helper --pre-install ".$_POST['kernel'].
    7.27 +			   " ".$_POST['tmp_dir']); 
    7.28 +	}
    7.29 +?>
    7.30 +
    7.31 +<a name="initramfs"></a>
    7.32 +<h2>Additional RAM filesystem</h2>
    7.33 +
    7.34 +<form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="packages">
    7.35 +
    7.36 +<?php
    7.37 +	echo shell_exec("./helper --list-pkgs ".$_POST["tmp_dir"]);
    7.38 +	post_hidden();
    7.39 +?>
    7.40 +<p>
    7.41 +</p>
    7.42 +
    7.43 +<div align="center">
    7.44 +<input name="continue" value="Continue" type="submit" />
    7.45 +</div>
    7.46 +
    7.47 +</form>
    7.48 +
    7.49 +<?php
    7.50 +}
    7.51 +?>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/step4.php	Fri Mar 23 19:37:38 2012 +0100
     8.3 @@ -0,0 +1,60 @@
     8.4 +<?php
     8.5 +
     8.6 +if (isset($_POST['packages']) && !isset($_POST['toconfigure'])) {
     8.7 +	$_POST['toconfigure'] = shell_exec("./helper --depends ".
     8.8 +				$_POST['tmp_dir']." ".$_POST['packages']);
     8.9 +}
    8.10 +
    8.11 +if (isset($_POST['configuring'])) {
    8.12 +	$pkg = $_POST['configuring'];
    8.13 +	$fp = fopen($_POST['tmp_dir']."vars","w");
    8.14 +	foreach ($_POST as $key => $val) {
    8.15 +		if (in_array($key, $usedvars)) continue;
    8.16 +		fwrite($fp,"export ".$key."='".$val."'\n");
    8.17 +	}
    8.18 +	fclose($fp);
    8.19 +	shell_exec("sudo ./helper --post-install $pkg ".$_POST['tmp_dir']); 
    8.20 +}
    8.21 +
    8.22 +$output = '';
    8.23 +if (isset($_POST['toconfigure']) && $_POST['toconfigure'] != "") {
    8.24 +	$pkgs = explode(" ",$_POST['toconfigure']);
    8.25 +	foreach ($pkgs as $key => $pkg) {
    8.26 +		shell_exec("sudo ./helper --pre-install $pkg ".$_POST['tmp_dir']); 
    8.27 +		$output = shell_exec("./helper --get-form $pkg ".
    8.28 +				$_POST['tmp_dir']); 
    8.29 +		unset($pkgs[$key]);
    8.30 +		$_POST['toconfigure'] = implode(" ", $pkgs);
    8.31 +		if ($output == "") {
    8.32 +			shell_exec("sudo ./helper --post-install $pkg ".
    8.33 +				   $_POST['tmp_dir']); 
    8.34 +			continue;
    8.35 +		}
    8.36 +?>
    8.37 +
    8.38 +<a name="configuration"></a>
    8.39 +<h2><?php echo $pkg; ?> configuration</h2>
    8.40 +
    8.41 +<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
    8.42 +
    8.43 +<input name="configuring" value="<?php echo $pkg; ?>" type="hidden" />
    8.44 +<?php
    8.45 +		echo $output;
    8.46 +		post_hidden();
    8.47 +?>
    8.48 +<p>
    8.49 +</p>
    8.50 +
    8.51 +<div align="center">
    8.52 +<input name="continue" value="Continue" type="submit" />
    8.53 +</div>
    8.54 +
    8.55 +</form>
    8.56 +
    8.57 +<?php
    8.58 +		echo shell_exec("./helper --get-note $pkg ".$_POST['tmp_dir']); 
    8.59 +		break;
    8.60 +	}
    8.61 +
    8.62 +}
    8.63 +?>
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/step5.php	Fri Mar 23 19:37:38 2012 +0100
     9.3 @@ -0,0 +1,122 @@
     9.4 +<?php
     9.5 +
     9.6 +function show_size($file)
     9.7 +{
     9.8 +	return shell_exec("du -h ".$_POST['tmp_dir'].
     9.9 +		"$file | awk '{ printf \"%s\",$1 }'");
    9.10 +	
    9.11 +}
    9.12 + 
    9.13 +if (isset($_POST['toconfigure']) && $_POST['toconfigure'] == ""
    9.14 +    && $output == "") {
    9.15 +	shell_exec("sudo ./helper --mkrootfs ".$_POST['tmp_dir']); 
    9.16 +?>
    9.17 +
    9.18 +<a name="get"></a>
    9.19 +<h2>Get Tiny SliTaz files</h2>
    9.20 +
    9.21 +<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="config">
    9.22 +
    9.23 +<?php	post_hidden(); ?>
    9.24 +<h3>Bootable images</h3>
    9.25 +<p>
    9.26 +<div align="center">
    9.27 +<input name="download" value="Floppy image" type="submit" />
    9.28 +<?php if (file_exists("/boot/isolinux/isolinux.bin")) { ?>
    9.29 +&nbsp;
    9.30 +<input name="download" value="ISO image" type="submit" />
    9.31 +<?php } ?>
    9.32 +</div>
    9.33 +</p>
    9.34 +
    9.35 +<h3>Files for bootloaders</h3>
    9.36 +<p>
    9.37 +<div align="center">
    9.38 +<input name="download" value="Kernel (<?php echo show_size("fs/boot/bzImage");
    9.39 + ?>)" type="submit" />
    9.40 +&nbsp;
    9.41 +<input name="download" value="Rootfs (<?php echo show_size("rootfs.gz");
    9.42 + ?>)" type="submit" />
    9.43 +</div>
    9.44 +</p>
    9.45 +
    9.46 +<h3>Configuration info</h3>
    9.47 +<p>
    9.48 +<div align="center">
    9.49 +<input name="download" value="Configuration files" type="submit" />
    9.50 +&nbsp;
    9.51 +<input name="download" value="packages.conf (<?php 
    9.52 +echo show_size("fs/etc/packages.conf"); ?>)" type="submit" />
    9.53 +</div>
    9.54 +</p>
    9.55 +
    9.56 +<?php if (show_size("fs/boot/System.map") != "") { ?>
    9.57 +<h3>Debug info</h3>
    9.58 +<p>
    9.59 +<div align="center">
    9.60 +<input name="download" value="System.map (<?php echo show_size("fs/boot/System.map");
    9.61 + ?>)" type="submit" />
    9.62 +&nbsp;
    9.63 +<input name="download" value="linux.config (<?php echo show_size("fs/boot/config");
    9.64 + ?>)" type="submit" />
    9.65 +</div>
    9.66 +</p>
    9.67 +<p>
    9.68 +<div align="center">
    9.69 +<input name="download" value="busybox.config (<?php echo show_size("fs/boot/config-busybox");
    9.70 + ?>)" type="submit" />
    9.71 +&nbsp;
    9.72 +<input name="download" value="post_install.log (<?php echo show_size("post_install.log");
    9.73 + ?>)" type="submit" />
    9.74 +</div>
    9.75 +</p>
    9.76 +<?php } ?>
    9.77 +
    9.78 +</form>
    9.79 +
    9.80 +<h2>Going further</h2>
    9.81 +<p>
    9.82 +Tiny SliTaz should be smaller to have more functionality
    9.83 +and/or needs less RAM.<br />
    9.84 +The kernel can be <a href="http://elinux.org/Linux_Tiny">tuned/patched</a>
    9.85 +or you can use an earlier version.
    9.86 +</p>
    9.87 +<p>
    9.88 +You can test Tiny SliTaz without pre-historic hardware using qemu:
    9.89 +</p>
    9.90 +<pre>
    9.91 +qemu -cpu 486 -m 8 -net nic,model=ne2k_isa -net tap -fda slitaz.img
    9.92 +</pre>
    9.93 +<p>
    9.94 +Or
    9.95 +</p>
    9.96 +<pre>
    9.97 +qemu -cpu 486 -m 8 -net nic,model=ne2k_isa -net tap -snapshot \
    9.98 +     -kernel kernel -initrd rootfs.gz /dev/zero
    9.99 +</pre>
   9.100 +<p>
   9.101 +And the executable file /etc/qemu-ifup:
   9.102 +</p>
   9.103 +<pre>
   9.104 +#!/bin/sh
   9.105 +
   9.106 +if [ -x /usr/sbin/openvpn ]; then
   9.107 +	openvpn --mktun --dev $1 --user `id -un`
   9.108 +else
   9.109 +	tunctl -u `id -un` -t $1                           
   9.110 +fi                              
   9.111 +ifconfig $1 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0
   9.112 +</pre>
   9.113 +<p>
   9.114 +You can also update the file /etc/resolv.conf on the Tiny SliTaz guest with your
   9.115 +nameserver(s) and enable the ip routing on your desktop:
   9.116 +</p>
   9.117 +<pre>
   9.118 +# echo 1 > /proc/sys/net/ipv4/ip_forward
   9.119 +# yes y | tazpkg get-install iptables
   9.120 +# iptables -t nat -A POSTROUTING -j MASQUERADE
   9.121 +</pre>
   9.122 +
   9.123 +<?php
   9.124 +}
   9.125 +?>
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tiny.css	Fri Mar 23 19:37:38 2012 +0100
    10.3 @@ -0,0 +1,14 @@
    10.4 +
    10.5 +#header { 
    10.6 +	border-bottom: 6px solid #d66018;
    10.7 +	color: #ffffff;
    10.8 +	font-weight: bold;
    10.9 +}
   10.10 +
   10.11 +#copy {
   10.12 +	text-align: center;
   10.13 +}
   10.14 +
   10.15 +#bottom {
   10.16 +	text-align: center;
   10.17 +}
    11.1 Binary file tinyslitaz-boot.png has changed
    12.1 Binary file tinyslitaz-httpinfo.png has changed
    13.1 Binary file tinyslitaz.png has changed