wok rev 5974

mirror-tools: fix FSH
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Aug 09 09:37:59 2010 +0200 (2010-08-09)
parents 6ef670b41c80
children 75dd5efa3105
files mirror-tools/stuff/host/boot/lguest-disk mirror-tools/stuff/host/boot/lguest-slitaz mirror-tools/stuff/host/etc/apache/conf.d/slitaz mirror-tools/stuff/host/etc/apache/conf.d/slitaz-ssl mirror-tools/stuff/host/install mirror-tools/stuff/usr/share/mirror-host/boot/lguest-disk mirror-tools/stuff/usr/share/mirror-host/boot/lguest-slitaz mirror-tools/stuff/usr/share/mirror-host/etc/apache/conf.d/slitaz mirror-tools/stuff/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl mirror-tools/stuff/usr/share/mirror-host/install
line diff
     1.1 --- a/mirror-tools/stuff/host/boot/lguest-disk	Sun Aug 08 19:48:39 2010 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,59 +0,0 @@
     1.4 -#!/bin/sh
     1.5 -
     1.6 -usage()
     1.7 -{
     1.8 -	cat << EOT
     1.9 -resize2fs
    1.10 -usage: 
    1.11 -$0 grow <guest> <size>[MG]
    1.12 -$0 fixmbr <guest>
    1.13 -EOT
    1.14 -	exit 1
    1.15 -}
    1.16 -
    1.17 -grow()
    1.18 -{
    1.19 -	case "$2" in
    1.20 -	*M)	dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;;
    1.21 -	*G)	dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;;
    1.22 -	esac
    1.23 -}
    1.24 -
    1.25 -# write a 32 bits data
    1.26 -# usage: storelong offset data32 file
    1.27 -storelong()
    1.28 -{
    1.29 -	printf "00000  %02X %02X %02X %02X \n" \
    1.30 -		$(( $2 & 255 )) $(( ($2>>8) & 255 )) \
    1.31 -		$(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
    1.32 -	hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
    1.33 -}
    1.34 -
    1.35 -# read a 32 bits data
    1.36 -# usage: getlong offset file
    1.37 -getlong()
    1.38 -{
    1.39 -	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
    1.40 -		hexdump -e '"" 1/4 "%d" "\n"'
    1.41 -}
    1.42 -
    1.43 -fixmbr()
    1.44 -{
    1.45 -	if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then
    1.46 -		echo "Parttion 3 & 4 non empty. Abort"
    1.47 -		exit 1
    1.48 -	fi
    1.49 -	if [ $(getlong 0x1da $1) -eq 0 ]; then
    1.50 -		echo "Parttion 2 empty. Abort"
    1.51 -		exit 1
    1.52 -	fi
    1.53 -	size=$(stat -c %s $1)
    1.54 -	new=$(( $size/512 - 32 - $(getlong 0x1ca $1) ))
    1.55 -	storelong 0x1da $new $1
    1.56 -}
    1.57 -
    1.58 -case "$1" in
    1.59 -grow)	shift; grow $@ ; fixmbr $1 ;;
    1.60 -fixmbr) shift; fixmbr $1 ;;
    1.61 -*)	usage ;;
    1.62 -esac
     2.1 --- a/mirror-tools/stuff/host/boot/lguest-slitaz	Sun Aug 08 19:48:39 2010 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,21 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -
     2.6 -tty=tty; [ -n "$1" ] && tty=$1
     2.7 -export TERM=$tty
     2.8 -shift
     2.9 -
    2.10 -rootfs="--initrd=/boot/rootfs-lguest.gz"
    2.11 -[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2"
    2.12 -shift
    2.13 -
    2.14 -net="--tunnet=192.168.0.1"
    2.15 -case "$1" in
    2.16 -192*) net="--tunnet=$1"; shift;;
    2.17 -esac
    2.18 -
    2.19 -args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf"
    2.20 -[ -n "$1" ] && args=$@
    2.21 -
    2.22 -/sbin/modprobe lg
    2.23 -/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \
    2.24 -	$net $rootfs $args > /dev/$tty < /dev/$tty 2>&1
     3.1 --- a/mirror-tools/stuff/host/etc/apache/conf.d/slitaz	Sun Aug 08 19:48:39 2010 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,16 +0,0 @@
     3.4 -<VirtualHost *:80>
     3.5 -	ServerName      mirror.slitaz.org
     3.6 -	ServerAlias	*.slitaz.org
     3.7 -	<IfModule mod_proxy.c>
     3.8 -		ProxyPreserveHost On
     3.9 -		ProxyRequests Off
    3.10 -		ProxyTimeout 600
    3.11 -		<Proxy *>
    3.12 -			Order deny,allow
    3.13 -			Allow from all
    3.14 -		</Proxy>
    3.15 -		ProxyPass / http://192.168.0.6/
    3.16 -		ProxyPassReverse / http://192.168.0.6/
    3.17 -	</IfModule>
    3.18 -</VirtualHost>
    3.19 -
     4.1 --- a/mirror-tools/stuff/host/etc/apache/conf.d/slitaz-ssl	Sun Aug 08 19:48:39 2010 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,20 +0,0 @@
     4.4 -<VirtualHost *:443>
     4.5 -	SSLProxyEngine On
     4.6 -	SSLEngine On
     4.7 -	ServerName      mirror.slitaz.org:443
     4.8 -	ServerAlias	*.slitaz.org
     4.9 -	SSLCertificateFile /etc/ssl/apache/slitaz.org.pem
    4.10 -	SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem
    4.11 -	<IfModule mod_proxy.c>
    4.12 -		ProxyPreserveHost On
    4.13 -		ProxyRequests Off
    4.14 -		ProxyTimeout 600
    4.15 -		<Proxy *>
    4.16 -			Order deny,allow
    4.17 -			Allow from all
    4.18 -		</Proxy>
    4.19 -		ProxyPass / http://192.168.0.6/
    4.20 -		ProxyPassReverse / http://192.168.0.6/
    4.21 -	</IfModule>
    4.22 -</VirtualHost>
    4.23 -
     5.1 --- a/mirror-tools/stuff/host/install	Sun Aug 08 19:48:39 2010 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,25 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -
     5.6 -grep -qs lguest-slitaz /etc/inittab || {
     5.7 -sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab
     5.8 -cat >> /etc/init.d/local.sh <<EOT
     5.9 -. /etc/network.conf
    5.10 -iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE
    5.11 -for port in 22 873 ; do
    5.12 -	iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \
    5.13 -			-j DNAT --to-destination 192.168.0.6:$port
    5.14 -done
    5.15 -for port in 80 443 ; do
    5.16 -	iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT
    5.17 -done
    5.18 -for iface in tap+ ; do
    5.19 -	iptables -A INPUT  -i $iface -j ACCEPT
    5.20 -	iptables -A OUTPUT -o $iface -j ACCEPT
    5.21 -	iptables -A FORWARD -i $iface -m state \
    5.22 -			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
    5.23 -	iptables -A FORWARD -o $iface -m state \
    5.24 -			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
    5.25 -done
    5.26 -echo "1" > /proc/sys/net/ipv4/ip_forward
    5.27 -EOT
    5.28 -}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/mirror-tools/stuff/usr/share/mirror-host/boot/lguest-disk	Mon Aug 09 09:37:59 2010 +0200
     6.3 @@ -0,0 +1,59 @@
     6.4 +#!/bin/sh
     6.5 +
     6.6 +usage()
     6.7 +{
     6.8 +	cat << EOT
     6.9 +resize2fs
    6.10 +usage: 
    6.11 +$0 grow <guest> <size>[MG]
    6.12 +$0 fixmbr <guest>
    6.13 +EOT
    6.14 +	exit 1
    6.15 +}
    6.16 +
    6.17 +grow()
    6.18 +{
    6.19 +	case "$2" in
    6.20 +	*M)	dd if=/dev/zero bs=1M count=${2%M} >> /boot/guests/$1 ;;
    6.21 +	*G)	dd if=/dev/zero bs=1G count=${2%G} >> /boot/guests/$1 ;;
    6.22 +	esac
    6.23 +}
    6.24 +
    6.25 +# write a 32 bits data
    6.26 +# usage: storelong offset data32 file
    6.27 +storelong()
    6.28 +{
    6.29 +	printf "00000  %02X %02X %02X %02X \n" \
    6.30 +		$(( $2 & 255 )) $(( ($2>>8) & 255 )) \
    6.31 +		$(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
    6.32 +	hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
    6.33 +}
    6.34 +
    6.35 +# read a 32 bits data
    6.36 +# usage: getlong offset file
    6.37 +getlong()
    6.38 +{
    6.39 +	dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
    6.40 +		hexdump -e '"" 1/4 "%d" "\n"'
    6.41 +}
    6.42 +
    6.43 +fixmbr()
    6.44 +{
    6.45 +	if [ $(getlong 0x1ea $1) -ne 0 -a $(getlong 0x1fa $1) -ne 0 ]; then
    6.46 +		echo "Parttion 3 & 4 non empty. Abort"
    6.47 +		exit 1
    6.48 +	fi
    6.49 +	if [ $(getlong 0x1da $1) -eq 0 ]; then
    6.50 +		echo "Parttion 2 empty. Abort"
    6.51 +		exit 1
    6.52 +	fi
    6.53 +	size=$(stat -c %s $1)
    6.54 +	new=$(( $size/512 - 32 - $(getlong 0x1ca $1) ))
    6.55 +	storelong 0x1da $new $1
    6.56 +}
    6.57 +
    6.58 +case "$1" in
    6.59 +grow)	shift; grow $@ ; fixmbr $1 ;;
    6.60 +fixmbr) shift; fixmbr $1 ;;
    6.61 +*)	usage ;;
    6.62 +esac
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/mirror-tools/stuff/usr/share/mirror-host/boot/lguest-slitaz	Mon Aug 09 09:37:59 2010 +0200
     7.3 @@ -0,0 +1,21 @@
     7.4 +#!/bin/sh
     7.5 +
     7.6 +tty=tty; [ -n "$1" ] && tty=$1
     7.7 +export TERM=$tty
     7.8 +shift
     7.9 +
    7.10 +rootfs="--initrd=/boot/rootfs-lguest.gz"
    7.11 +[ -n "$1" ] && rootfs="--block=$1 root=/dev/vda2"
    7.12 +shift
    7.13 +
    7.14 +net="--tunnet=192.168.0.1"
    7.15 +case "$1" in
    7.16 +192*) net="--tunnet=$1"; shift;;
    7.17 +esac
    7.18 +
    7.19 +args="screen=text lang=fr_FR kmap=fr-latin1 sound=noconf"
    7.20 +[ -n "$1" ] && args=$@
    7.21 +
    7.22 +/sbin/modprobe lg
    7.23 +/usr/bin/lguest 512 /boot/vmlinuz-2.6.25.5-lguest \
    7.24 +	$net $rootfs $args > /dev/$tty < /dev/$tty 2>&1
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/mirror-tools/stuff/usr/share/mirror-host/etc/apache/conf.d/slitaz	Mon Aug 09 09:37:59 2010 +0200
     8.3 @@ -0,0 +1,16 @@
     8.4 +<VirtualHost *:80>
     8.5 +	ServerName      mirror.slitaz.org
     8.6 +	ServerAlias	*.slitaz.org
     8.7 +	<IfModule mod_proxy.c>
     8.8 +		ProxyPreserveHost On
     8.9 +		ProxyRequests Off
    8.10 +		ProxyTimeout 600
    8.11 +		<Proxy *>
    8.12 +			Order deny,allow
    8.13 +			Allow from all
    8.14 +		</Proxy>
    8.15 +		ProxyPass / http://192.168.0.6/
    8.16 +		ProxyPassReverse / http://192.168.0.6/
    8.17 +	</IfModule>
    8.18 +</VirtualHost>
    8.19 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/mirror-tools/stuff/usr/share/mirror-host/etc/apache/conf.d/slitaz-ssl	Mon Aug 09 09:37:59 2010 +0200
     9.3 @@ -0,0 +1,20 @@
     9.4 +<VirtualHost *:443>
     9.5 +	SSLProxyEngine On
     9.6 +	SSLEngine On
     9.7 +	ServerName      mirror.slitaz.org:443
     9.8 +	ServerAlias	*.slitaz.org
     9.9 +	SSLCertificateFile /etc/ssl/apache/slitaz.org.pem
    9.10 +	SSLCertificateKeyFile /etc/ssl/apache/slitaz.org.pem
    9.11 +	<IfModule mod_proxy.c>
    9.12 +		ProxyPreserveHost On
    9.13 +		ProxyRequests Off
    9.14 +		ProxyTimeout 600
    9.15 +		<Proxy *>
    9.16 +			Order deny,allow
    9.17 +			Allow from all
    9.18 +		</Proxy>
    9.19 +		ProxyPass / http://192.168.0.6/
    9.20 +		ProxyPassReverse / http://192.168.0.6/
    9.21 +	</IfModule>
    9.22 +</VirtualHost>
    9.23 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/mirror-tools/stuff/usr/share/mirror-host/install	Mon Aug 09 09:37:59 2010 +0200
    10.3 @@ -0,0 +1,25 @@
    10.4 +#!/bin/sh
    10.5 +
    10.6 +grep -qs lguest-slitaz /etc/inittab || {
    10.7 +sed -i 's|^tty1::|tty16::respawn:/boot/lguest-slitaz tty16 /boot/guests/mirror.slitaz.org 192.168.0.1\n&|' /etc/inittab
    10.8 +cat >> /etc/init.d/local.sh <<EOT
    10.9 +. /etc/network.conf
   10.10 +iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE
   10.11 +for port in 22 873 ; do
   10.12 +	iptables -t nat -A PREROUTING -i $INTERFACE --dport $port \
   10.13 +			-j DNAT --to-destination 192.168.0.6:$port
   10.14 +done
   10.15 +for port in 80 443 ; do
   10.16 +	iptables -A INPUT -p tcp -m tcp --dport $port -j ACCEPT
   10.17 +done
   10.18 +for iface in tap+ ; do
   10.19 +	iptables -A INPUT  -i $iface -j ACCEPT
   10.20 +	iptables -A OUTPUT -o $iface -j ACCEPT
   10.21 +	iptables -A FORWARD -i $iface -m state \
   10.22 +			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   10.23 +	iptables -A FORWARD -o $iface -m state \
   10.24 +			--state NEW,RELATED,ESTABLISHED,UNTRACKED -j ACCEPT
   10.25 +done
   10.26 +echo "1" > /proc/sys/net/ipv4/ip_forward
   10.27 +EOT
   10.28 +}