wok rev 11997

New style loram
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 04 16:35:24 2012 +0100 (2012-03-04)
parents 7611f82bb0f5
children 2142911d2464
files slitaz-loram-cdrom/receipt slitaz-loram-cdrom/stuff/loram.extract slitaz-loram-cdrom/stuff/loram.final slitaz-loram-cdrom/stuff/loram.rootfs slitaz-loram/receipt slitaz-loram/stuff/loram.extract slitaz-loram/stuff/loram.final slitaz-loram/stuff/loram.iso slitaz-loram/stuff/loram.rootfs
line diff
     1.1 --- a/slitaz-loram-cdrom/receipt	Sun Mar 04 09:52:39 2012 +0100
     1.2 +++ b/slitaz-loram-cdrom/receipt	Sun Mar 04 16:35:24 2012 +0100
     1.3 @@ -1,12 +1,12 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="slitaz-loram-cdrom"
     1.7 -VERSION="1.5"
     1.8 +VERSION="2.0"
     1.9  CATEGORY="misc"
    1.10  SHORT_DESC="Rules to build low ram system using cdrom."
    1.11  MAINTAINER="pascal.bellard@slitaz.org"
    1.12  WEB_SITE="http://www.slitaz.org/"
    1.13 -DEPENDS="slitaz-boot-scripts tazlito"
    1.14 +DEPENDS=""
    1.15  
    1.16  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.17  genpkg_rules()
    1.18 @@ -14,192 +14,3 @@
    1.19      mkdir -p $fs/etc/tazlito
    1.20      cp stuff/loram.* $fs/etc/tazlito
    1.21  }
    1.22 -
    1.23 -set_patch()
    1.24 -{
    1.25 -    local tag
    1.26 -    local line
    1.27 -    local len
    1.28 -    local i
    1.29 -    tag="Handle kernel cmdline parameter config"
    1.30 -    i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
    1.31 -    i=$(($i-1))
    1.32 -    len=88
    1.33 -    tag=$(grep "$tag" $1/etc/init.d/rcS)
    1.34 -    if [ "$2" = "-R" ]; then
    1.35 -    	line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
    1.36 -	i="-"
    1.37 -    else
    1.38 -        grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
    1.39 -    	line="-$i,2 +$i,$len"
    1.40 -	i="+"
    1.41 -    fi
    1.42 -    busybox patch -p0 <<EOF
    1.43 ---- $1/etc/init.d/rcS
    1.44 -+++ $1/etc/init.d/rcS
    1.45 -@@ $line @@
    1.46 - 
    1.47 -$i# Try to release the cdrom (from slitaz-loram-cdrom package)
    1.48 -$i release_cdrom()
    1.49 -$i {
    1.50 -$i	FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')	
    1.51 -$i	if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
    1.52 -$i		if ! grep -q " keep-loram" /proc/cmdline &&
    1.53 -$i		    [ -d \$FS -o \$FREEMEM -gt \$(du -s \$FS | \\
    1.54 -$i			awk '{ print (\$1*4)+40000 }') ]; then
    1.55 -$i			echo -n "Extracting loram..."
    1.56 -$i			. /etc/tazlito/loram.extract /cdrom
    1.57 -$i			if status; then
    1.58 -$i				umount /cdrom
    1.59 -$i				rmdir /cdrom
    1.60 -$i				yes y | tazpkg remove slitaz-loram-cdrom > /dev/null
    1.61 -$i				return 0
    1.62 -$i			fi
    1.63 -$i		fi
    1.64 -$i		cp -a \$FS /.usr.fs
    1.65 -$i		status
    1.66 -$i		echo -n "Releasing CD-ROM..."
    1.67 -$i		umount /cdrom
    1.68 -$i		FS=/.usr.fs
    1.69 -$i		if [ -d \$FS ]; then
    1.70 -$i			rm -f /\$usr
    1.71 -$i			mv \$FS /usr
    1.72 -$i		fi
    1.73 -$i	fi
    1.74 -$i	return 1
    1.75 -$i }
    1.76 -$i
    1.77 -$i# Mount /usr (from slitaz-loram-cdrom package)
    1.78 -$i if [ -d /cdrom ]; then
    1.79 -$i 	DEVICE=/dev/cdrom
    1.80 -$i 	DIR=
    1.81 -$i	if grep -q " loram=" /proc/cmdline; then
    1.82 -$i		DIR=\`cat /proc/cmdline | sed 's/.* loram=\([^ ]*\).*/\1/'\`
    1.83 -$i		DEVICE=\${DIR%,*}
    1.84 -$i		DIR=/\${DIR#*,}
    1.85 -$i	fi
    1.86 -$i	if ! /bin/mount -r \$DEVICE /cdrom; then
    1.87 -$i		if echo \$DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then
    1.88 -$i			USBDELAY=\`cat /sys/module/usb_storage/parameters/delay_use\`
    1.89 -$i			USBDELAY=\$((1+\$USBDELAY))
    1.90 -$i			echo "\$DEVICE is potentially a USB device: sleep for \$USBDELAY seconds"
    1.91 -$i			sleep \$USBDELAY
    1.92 -$i		fi
    1.93 -$i		if ! /bin/mount -r \$DEVICE /cdrom; then
    1.94 -$i			DEVICE=""
    1.95 -$i		fi
    1.96 -$i	fi
    1.97 -$i	while [ -n "\$DEVICE" ]; do
    1.98 -$i		if [ -d /.usr.rw ]; then
    1.99 -$i			echo -n "Mounting /usr read-write... "
   1.100 -$i			usr=.usr.ro
   1.101 -$i		else
   1.102 -$i			echo -n "Mounting /usr read-only... "
   1.103 -$i			usr=usr
   1.104 -$i		fi
   1.105 -$i		FS=/cdrom\$DIR/usr.cromfs
   1.106 -$i		if [ -f \$FS ]; then
   1.107 -$i			release_cdrom && break
   1.108 -$i			/bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
   1.109 -$i		elif [ -f /cdrom\$DIR/usr.sqfs ]; then
   1.110 -$i			FS=/cdrom\$DIR/usr.sqfs
   1.111 -$i			release_cdrom && break
   1.112 -$i			mount -o loop,ro -t squashfs \$FS /\$usr
   1.113 -$i		elif [ -L /\$usr ]; then
   1.114 -$i			FS=/cdrom\$DIR/usr
   1.115 -$i			release_cdrom && break
   1.116 -$i			true
   1.117 -$i		else
   1.118 -$i			umount /cdrom
   1.119 -$i			false
   1.120 -$i		fi
   1.121 -$i		status 
   1.122 -$i		if [ -d /.usr.rw ]; then
   1.123 -$i			if [ -x /bin/funionfs ]; then
   1.124 -$i				/bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
   1.125 -$i			else
   1.126 -$i				/bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
   1.127 -$i			fi
   1.128 -$i		fi
   1.129 -$i		break
   1.130 -$i	done
   1.131 -$i fi
   1.132 -$i
   1.133 - $tag
   1.134 -EOF
   1.135 -    tag="/var/log/dmesg.log"
   1.136 -    i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
   1.137 -    i=$(($i-1))
   1.138 -    len=9
   1.139 -    tag=$(grep "$tag" $1/etc/init.d/rcS)
   1.140 -    if [ "$2" = "-R" ]; then
   1.141 -    	line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
   1.142 -	i="-"
   1.143 -    else
   1.144 -    	line="-$i,2 +$i,$len"
   1.145 -	i="+"
   1.146 -    fi
   1.147 -    busybox patch -p0 <<EOF
   1.148 ---- $1/etc/init.d/rcS
   1.149 -+++ $1/etc/init.d/rcS
   1.150 -@@ $line @@
   1.151 - 
   1.152 -$i# Build ramdisk if root=/dev/cdrom (from slitaz-loram-cdrom package)
   1.153 -$i if [ -L /root ]; then
   1.154 -$i	mount -t tmpfs ramdisk /tmp
   1.155 -$i	mkdir -p /tmp/log/lighttpd /tmp/run /tmp/lock
   1.156 -$i	chown www.www /tmp/log/lighttpd
   1.157 -$i fi
   1.158 -$i
   1.159 - $tag
   1.160 -EOF
   1.161 -    chmod 0755 $1/etc/init.d/rcS
   1.162 -}
   1.163 -
   1.164 -# Pre and post install commands for Tazpkg.
   1.165 -pre_install()
   1.166 -{
   1.167 -    local i
   1.168 -    for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
   1.169 -        [ "$i" = "$PACKAGE" ] && continue
   1.170 -        yes y | tazpkg remove $i
   1.171 -        . /etc/tazlito/tazlito.conf
   1.172 -	rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
   1.173 -    done
   1.174 -}
   1.175 -
   1.176 -post_install()
   1.177 -{
   1.178 -    set_patch "$1"
   1.179 -    
   1.180 -    # Don't support FAST_BOOT_X yet
   1.181 -    sed -i 's/FAST_BOOT_X=.*/FAST_BOOT_X="no"/' $1/etc/rcS.conf
   1.182 -    
   1.183 -    cat <<EOF
   1.184 -----
   1.185 -'tazlito gen-distro' will create a loram-cdrom flavor
   1.186 -while this package is installed.
   1.187 -EOF
   1.188 -    if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs-utils ]; then
   1.189 -        cat <<EOF
   1.190 -----
   1.191 -You will build a live CD with /usr mounted read-only.
   1.192 -You can install aufs or funionfs to have read-write access into /usr with:
   1.193 -
   1.194 -# tazpkg get-install aufs
   1.195 -or
   1.196 -# tazpkg get-install funionfs
   1.197 -
   1.198 -EOF
   1.199 -    fi
   1.200 -}
   1.201 -
   1.202 -# Pre remove commands for Tazpkg.
   1.203 -pre_remove()
   1.204 -{
   1.205 -    set_patch '' -R 
   1.206 -    cat <<EOF
   1.207 -----
   1.208 -'tazlito gen-distro' will work as expected now.
   1.209 -EOF
   1.210 -}
     2.1 --- a/slitaz-loram-cdrom/stuff/loram.extract	Sun Mar 04 09:52:39 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,51 +0,0 @@
     2.4 -# remove link to cdrom
     2.5 -[ -d cdrom ] && rmdir cdrom 2> /dev/null
     2.6 -rmdir .usr* 2> /dev/null
     2.7 -if [ -L usr ]; then
     2.8 -	rm usr
     2.9 -	cp -a $1/usr .
    2.10 -fi
    2.11 -packedfs="$1/usr.cromfs"
    2.12 -if [ -f $packedfs ]; then
    2.13 -	rmdir usr
    2.14 -	rm -f bin/unmkcromfs
    2.15 -	cp -a $1/unmkcromfs bin/unmkcromfs
    2.16 -	bin/unmkcromfs $packedfs usr > /dev/null
    2.17 -	[ "${packedfs%%/*}" = ".." ] && rm -f $packedfs
    2.18 -	rm -f bin/cromfs-driver
    2.19 -	cp -a $1/cromfs-driver bin/cromfs-driver
    2.20 -fi
    2.21 -packedfs="$1/usr.sqfs"
    2.22 -if [ -f $packedfs ]; then
    2.23 -	rmdir usr
    2.24 -	sbin/unsquashfs -d usr $packedfs > /dev/null
    2.25 -	[ "${packedfs%%/*}" = ".." ] && rm -f $packedfs
    2.26 -fi
    2.27 -if [ -d usr/.moved ]; then
    2.28 -	( cd usr/.moved ; find * -print ) | \
    2.29 -	while read file; do
    2.30 -		[ -L "$file" ] || continue
    2.31 -		rm -f "$file"
    2.32 -		mv "usr/.moved/$file" "$file"
    2.33 -	done
    2.34 -	rm -rf usr/.moved
    2.35 -fi
    2.36 -for ii in lib/libz.so lib/libstdc++.so lib/libgcc_s.so; do
    2.37 -	[ -e $ii ] && mv $ii* usr/lib/
    2.38 -done
    2.39 -if [ -L root ]; then
    2.40 -	rm -f etc/keymap.conf etc/locale.conf etc/resolv.conf etc/TZ etc/motd
    2.41 -	[ -d var/log.ORG  ] && mv -f var/log.ORG  var/log
    2.42 -	[ -d var/run.ORG  ] && mv -f var/run.ORG  var/run
    2.43 -	[ -d var/lock.ORG ] && mv -f var/lock.ORG var/lock
    2.44 -	[ -d root.ORG     ] && mv -f root.ORG     root
    2.45 -	rm -f media/cdrom
    2.46 -	rmdir mnt/target
    2.47 -	sed -i 's/CLEAN_UP_SYSTEM="no"/CLEAN_UP_SYSTEM="yes"/' etc/rcS.conf
    2.48 -	sed -i 's/RUN_DAEMONS="/RUN_DAEMONS="slim /' etc/rcS.conf
    2.49 -fi
    2.50 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \
    2.51 -	  bin/killall5 bin/seq bin/find bin/xargs bin/patch; do
    2.52 -	[ -e usr/$ii ] && rm -f $ii
    2.53 -done
    2.54 -[ -e usr/bin/vcsa2txt ] || rm -f bin/conspy
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/slitaz-loram-cdrom/stuff/loram.final	Sun Mar 04 16:35:24 2012 +0100
     3.3 @@ -0,0 +1,11 @@
     3.4 +cd $1/..
     3.5 +iso=$(ls *.iso)
     3.6 +if [ -s "$iso" ]; then
     3.7 +	echo "Converting $iso to low ram/cdrom iso..."
     3.8 +	yes y | tazlito build-loram $iso $iso.$$ cdrom
     3.9 +	mv -f $iso.$$ $iso
    3.10 +	md5sum $iso > ${iso%.iso}.md5
    3.11 +	echo "================================================================================"
    3.12 +fi
    3.13 +cd - > /dev/null
    3.14 +
     4.1 --- a/slitaz-loram-cdrom/stuff/loram.rootfs	Sun Mar 04 09:52:39 2012 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,106 +0,0 @@
     4.4 -echo "$(du -hs /usr | cut -f1) were used by /usr"
     4.5 -for j in insmod unmkcromfs unsquashfs ; do 
     4.6 -  lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\  -f3 | \
     4.7 -  while read ii; do
     4.8 -    mv .${ii%%.so.*}.so* ./lib
     4.9 -  done
    4.10 -done
    4.11 -for ii in /sbin /lib /bin; do
    4.12 -  mkdir -p ./usr/.moved$ii
    4.13 -  for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \
    4.14 -	   libcap; do
    4.15 -    for k in $(grep -s ^$ii /var/lib/tazpkg/installed/$j/files.list) ; do
    4.16 -      [ -f .$k ] || continue
    4.17 -      mv .$k ./usr/.moved$k
    4.18 -      ln -s /usr/.moved$k .$k 
    4.19 -    done
    4.20 -  done
    4.21 -done
    4.22 -k="$(ls /lib/lib[rp]*.so)"
    4.23 -[ -x /bin/funionfs ] && k="$(ls /lib/libresolv*.so)"
    4.24 -for ii in /var/lib/tazpkg/installed /lib/modules/*/kernel/drivers/net \
    4.25 -	  /lib/modules/*/kernel/sound /sbin/depmod /sbin/modinfo /sbin/lsmod \
    4.26 -	  /lib/libns*.so $k; do
    4.27 -  [ -L .$ii ] && continue
    4.28 -  case "$ii" in
    4.29 -  /lib/libnss_file*) continue;;
    4.30 -  /lib/libpthread*)  continue;;
    4.31 -  esac
    4.32 -  j=$(dirname /usr/.moved$ii)
    4.33 -  mkdir -p .$j
    4.34 -  mv .$ii .$j
    4.35 -  ln -s /usr/.moved$ii .$ii
    4.36 -done
    4.37 -echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr"
    4.38 -usr=usr
    4.39 -if [ -x bin/funionfs -o -d /var/lib/tazpkg/installed/aufs-utils ]; then
    4.40 -  usr=.usr.ro
    4.41 -  mkdir .usr.ro .usr.rw
    4.42 -fi
    4.43 -if [ -x bin/funionfs -o -x usr/bin/mkcromfs ]; then
    4.44 -  ln -s /$usr/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2
    4.45 -fi
    4.46 -if [ -x usr/bin/mkcromfs ]; then
    4.47 -  usr/bin/mkcromfs -qq -f 262144 -b 16384 usr ../rootcd/usr.cromfs
    4.48 -  rm -rf usr
    4.49 -  mkdir usr
    4.50 -  for ii in unmkcromfs cromfs-driver ; do
    4.51 -    mv bin/$ii ../rootcd
    4.52 -    ln -s /cdrom/$ii bin/$ii
    4.53 -  done
    4.54 -elif [ -x usr/sbin/mksquashfs ]; then
    4.55 -  usr/sbin/mksquashfs usr ../rootcd/usr.sqfs -comp xz -Xbcj x86
    4.56 -  rm -rf usr
    4.57 -  mkdir usr
    4.58 -else
    4.59 -  mv usr ../rootcd
    4.60 -  [ "$usr" = "usr" ] || mv $usr usr
    4.61 -  ln -s /cdrom/usr $usr
    4.62 -fi
    4.63 -if [ -d ../rootcd/usr/lib ]; then
    4.64 -  for ii in *; do
    4.65 -    case "$ii" in
    4.66 -    usr|boot|home) continue;;
    4.67 -    mnt|media|sys|proc|cdrom) mkdir ../rootcd/$ii;;
    4.68 -    *) cp -a $ii ../rootcd/$ii;;
    4.69 -    esac
    4.70 -  done
    4.71 -  for ii in media/*; do
    4.72 -    [ "$ii" = "media/cdrom" ] || mkdir ../rootcd/$ii
    4.73 -  done
    4.74 -  for ii in keymap.conf locale.conf resolv.conf TZ motd; do
    4.75 -    rm -f ../rootcd/etc/$ii
    4.76 -    ln -s /tmp/$ii ../rootcd/etc/$ii
    4.77 -  done
    4.78 -  ln -s /tmp/detected-modules ../rootcd/var/lib/detected-modules
    4.79 -  for ii in log run lock; do
    4.80 -    mv ../rootcd/var/$ii ../rootcd/var/$ii.ORG
    4.81 -    ln -s /tmp ../rootcd/var/$ii
    4.82 -  done
    4.83 -  mv ../rootcd/root ../rootcd/root.ORG
    4.84 -  ln -s /tmp ../rootcd/root
    4.85 -  ln -s /tmp ../rootcd/home
    4.86 -  ln -s / ../rootcd/media/cdrom
    4.87 -  mkdir ../rootcd/mnt/target
    4.88 -  sed -i 's/CLEAN_UP_SYSTEM="yes"/CLEAN_UP_SYSTEM="no"/' ../rootcd/etc/rcS.conf
    4.89 -  sed -i 's/RUN_DAEMONS=.*/RUN_DAEMONS=""/' ../rootcd/etc/rcS.conf
    4.90 -  for ii in ../rootcd/boot/isolinux/*.cfg; do
    4.91 -    cat $ii | awk '{ print } /append/ { printf "label loram\n\tkernel /boot/bzImage\n\tappend ro sound=noconf screen=text %s %s %s\n",$5,$6,$7 }' > $ii.tmp
    4.92 -    mv -f $ii.tmp $ii
    4.93 -  done
    4.94 -  cat >> ../rootcd/boot/isolinux/enopts.txt <<EOT
    4.95 - With few RAM, you can use loram entry with the cdrom device; example:
    4.96 - boot: loram root=/dev/hdc
    4.97 -EOT
    4.98 -  cat >> ../rootcd/boot/isolinux/options.txt <<EOT
    4.99 - Avec peu de RAM, utilisez l'entrée loram en précisant le cdrom, exemple:
   4.100 - boot: loram root=/dev/hdc
   4.101 -EOT
   4.102 -fi
   4.103 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \
   4.104 -	  bin/killall5 bin/seq bin/find bin/xargs bin/patch; do
   4.105 -  [ -e $ii ] || ln -s busybox $ii
   4.106 -done
   4.107 -[ -e bin/vcsa2txt ] || ln -s busybox bin/conspy
   4.108 -mkdir cdrom
   4.109 -COMPRESSION="gzip"
     5.1 --- a/slitaz-loram/receipt	Sun Mar 04 09:52:39 2012 +0100
     5.2 +++ b/slitaz-loram/receipt	Sun Mar 04 16:35:24 2012 +0100
     5.3 @@ -1,11 +1,11 @@
     5.4  # SliTaz package receipt.
     5.5  
     5.6  PACKAGE="slitaz-loram"
     5.7 -VERSION="1.6"
     5.8 +VERSION="2.0"
     5.9  CATEGORY="misc"
    5.10  SHORT_DESC="Rules to build low ram rootfs.gz."
    5.11  MAINTAINER="pascal.bellard@slitaz.org"
    5.12 -DEPENDS="slitaz-boot-scripts tazlito cromfs-or-squashfs"
    5.13 +DEPENDS=""
    5.14  WEB_SITE="http://www.slitaz.org/"
    5.15  
    5.16  # Rules to gen a SliTaz package suitable for Tazpkg.
    5.17 @@ -14,111 +14,3 @@
    5.18      mkdir -p $fs/etc/tazlito
    5.19      cp stuff/loram.* $fs/etc/tazlito
    5.20  }
    5.21 -
    5.22 -set_patch()
    5.23 -{
    5.24 -    local tag
    5.25 -    local line
    5.26 -    local len
    5.27 -    local i
    5.28 -    tag="Fast boot into X"
    5.29 -    i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
    5.30 -    i=$(($i-1))
    5.31 -    len=38
    5.32 -    tag=$(grep "$tag" $1/etc/init.d/rcS)
    5.33 -    if [ "$2" = "-R" ]; then
    5.34 -    	line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
    5.35 -	i="-"
    5.36 -    else
    5.37 -        grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return
    5.38 -    	line="-$i,2 +$i,$len"
    5.39 -	i="+"
    5.40 -    fi
    5.41 -    busybox patch -p0 <<EOF
    5.42 ---- $1/etc/init.d/rcS
    5.43 -+++ $1/etc/init.d/rcS
    5.44 -@@ $line @@
    5.45 - 
    5.46 -$i# Mount compressed /usr (from slitaz-loram package)
    5.47 -$i while [ -f /.usr.cromfs -o -f /.usr.sqfs ]; do
    5.48 -$i	usr=usr
    5.49 -$i	echo -n "Mounting /usr read-"
    5.50 -$i	if [ -d /.usr.rw ]; then
    5.51 -$i		usr=.usr.ro
    5.52 -$i		echo -n "write... "
    5.53 -$i	else
    5.54 -$i		echo -n "only... "
    5.55 -$i	fi
    5.56 -$i	FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
    5.57 -$i	if ! grep -q " keep-loram" /proc/cmdline && [ \$FREEMEM -gt \\
    5.58 -$i	\$(du -s \$FS | awk '{ print (\$1*4)+40000 }') ]; then
    5.59 -$i		echo -n "Extracting loram..."
    5.60 -$i		. /etc/tazlito/loram.extract
    5.61 -$i		if status; then
    5.62 -$i			yes y | tazpkg remove slitaz-loram > /dev/null
    5.63 -$i			break
    5.64 -$i		fi
    5.65 -$i	fi
    5.66 -$i	if [ -f /.usr.cromfs ]; then
    5.67 -$i		/bin/cromfs-driver /.usr.cromfs /\$usr -o ro,dev,suid,allow_other
    5.68 -$i	else
    5.69 -$i		/bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr
    5.70 -$i	fi
    5.71 -$i	if [ -d /.usr.rw ]; then
    5.72 -$i		if [ -x bin/funionfs ]; then
    5.73 -$i			/bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
    5.74 -$i		else
    5.75 -$i			/bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
    5.76 -$i		fi
    5.77 -$i	fi
    5.78 -$i	status
    5.79 -$i	break
    5.80 -$i done
    5.81 -$i
    5.82 - $tag
    5.83 -EOF
    5.84 -    chmod 0755 $1/etc/init.d/rcS
    5.85 -}
    5.86 -
    5.87 -# Pre and post install commands for Tazpkg.
    5.88 -pre_install()
    5.89 -{
    5.90 -    local i
    5.91 -    for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
    5.92 -        [ "$i" = "$PACKAGE" ] && continue
    5.93 -        yes y | tazpkg remove $i
    5.94 -        . /etc/tazlito/tazlito.conf
    5.95 -	rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
    5.96 -    done
    5.97 -}
    5.98 -
    5.99 -post_install()
   5.100 -{
   5.101 -    set_patch "$1"
   5.102 -    cat <<EOF
   5.103 -----
   5.104 -'tazlito gen-distro' will create a loram flavor while this package is installed.
   5.105 -EOF
   5.106 -    if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs-utils ]; then
   5.107 -        cat <<EOF
   5.108 -----
   5.109 -You will build a live CD with /usr mounted read-only.
   5.110 -You can install aufs or funionfs to have read-write access into /usr with:
   5.111 -
   5.112 -# tazpkg get-install aufs
   5.113 -or
   5.114 -# tazpkg get-install funionfs
   5.115 -
   5.116 -EOF
   5.117 -    fi
   5.118 -}
   5.119 -
   5.120 -# Pre remove commands for Tazpkg.
   5.121 -pre_remove()
   5.122 -{
   5.123 -    set_patch '' -R
   5.124 -    cat <<EOF
   5.125 -----
   5.126 -'tazlito gen-distro' will work as expected now.
   5.127 -EOF
   5.128 -}
     6.1 --- a/slitaz-loram/stuff/loram.extract	Sun Mar 04 09:52:39 2012 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,27 +0,0 @@
     6.4 -rmdir usr
     6.5 -rmdir .usr* 2> /dev/null
     6.6 -packedfs=".usr.cromfs"
     6.7 -if [ -f $packedfs ]; then
     6.8 -	bin/unmkcromfs $packedfs usr > /dev/null
     6.9 -	rm -f $packedfs
    6.10 -fi
    6.11 -packedfs=".usr.sqfs"
    6.12 -if [ -f $packedfs ]; then
    6.13 -	sbin/unsquashfs -d usr $packedfs > /dev/null
    6.14 -	rm -f $packedfs
    6.15 -fi
    6.16 -( cd usr/.moved ; find * -print ) | \
    6.17 -while read file; do
    6.18 -	[ -L "$file" ] || continue
    6.19 -	rm -f "$file"
    6.20 -	mv "usr/.moved/$file" "$file"
    6.21 -done
    6.22 -rm -rf usr/.moved
    6.23 -for ii in lib/libz.so lib/libstdc++.so lib/libgcc_s.so; do
    6.24 -	[ -e $ii ] && mv $ii* usr/lib/
    6.25 -done
    6.26 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \
    6.27 -	  bin/killall5 bin/seq bin/find bin/xargs bin/patch; do
    6.28 -	[ -e usr/$ii ] && rm -f $ii
    6.29 -done
    6.30 -[ -e usr/bin/vcsa2txt ] || rm -f bin/conspy
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/slitaz-loram/stuff/loram.final	Sun Mar 04 16:35:24 2012 +0100
     7.3 @@ -0,0 +1,11 @@
     7.4 +cd $1/..
     7.5 +iso=$(ls *.iso)
     7.6 +if [ -s "$iso" ]; then
     7.7 +	echo "Converting $iso to low ram iso..."
     7.8 +	yes y | tazlito build-loram $iso $iso.$$
     7.9 +	mv -f $iso.$$ $iso
    7.10 +	md5sum $iso > ${iso%.iso}.md5
    7.11 +	echo "================================================================================"
    7.12 +fi
    7.13 +cd - > /dev/null
    7.14 +
     8.1 --- a/slitaz-loram/stuff/loram.iso	Sun Mar 04 09:52:39 2012 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,8 +0,0 @@
     8.4 -if [ -s $1/rootfs.gz2 ]; then
     8.5 -	local rem
     8.6 -	rem=$(( $(stat -c "%s" $1/boot/rootfs.gz) % 4 ))
     8.7 -	[ $rem -ne 0 ] && 
     8.8 -	dd if=/dev/zero bs=1 count=$(( 4 - $rem )) >> $1/boot/rootfs.gz
     8.9 -	cat $1/rootfs.gz2 >> $1/boot/rootfs.gz
    8.10 -	rm -f $1/rootfs.gz2
    8.11 -fi
     9.1 --- a/slitaz-loram/stuff/loram.rootfs	Sun Mar 04 09:52:39 2012 +0100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,49 +0,0 @@
     9.4 -echo "$(du -hs ./usr | cut -f1) were used by /usr"
     9.5 -for j in insmod unmkcromfs unsquashfs ; do
     9.6 -  lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\  -f3 | \
     9.7 -  while read ii; do
     9.8 -    mv .${ii%%.so.*}.so* ./lib
     9.9 -  done
    9.10 -done
    9.11 -for ii in /sbin /lib /bin; do
    9.12 -  mkdir -p ./usr/.moved$ii
    9.13 -  for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \
    9.14 -	   libcap; do
    9.15 -    for k in $(grep -s ^$ii ./var/lib/tazpkg/installed/$j/files.list) ; do
    9.16 -      [ -f .$k ] || continue
    9.17 -      mv .$k ./usr/.moved$k
    9.18 -      ln -s /usr/.moved$k .$k 
    9.19 -    done
    9.20 -  done
    9.21 -done
    9.22 -for ii in /var/lib/tazpkg/installed ; do
    9.23 -  j=$(dirname /usr/.moved$ii)
    9.24 -  mkdir -p .$j
    9.25 -  mv .$ii .$j
    9.26 -  ln -s /usr/.moved$ii .$ii
    9.27 -done
    9.28 -echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr"
    9.29 -echo "$(du -hs ./usr | cut -f1) were used by /usr before compression"
    9.30 -usr=usr
    9.31 -if [ -x usr/bin/mkcromfs ]; then
    9.32 -  usr/bin/mkcromfs -qq -f 262144 -b 16384 usr .usr.cromfs
    9.33 -else
    9.34 -  usr/sbin/mksquashfs usr .usr.sqfs -comp xz -Xbcj x86
    9.35 -fi
    9.36 -if [ -x bin/funionfs -o -d /var/lib/tazpkg/installed/aufs-utils ]; then
    9.37 -  mkdir .usr.rw .usr.ro
    9.38 -  usr=.usr.ro
    9.39 -fi
    9.40 -if [ -x bin/funionfs -o -x usr/bin/mkcromfs ]; then
    9.41 -  ln -s /$usr/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2
    9.42 -fi
    9.43 -rm -rf usr
    9.44 -mkdir usr
    9.45 -echo "$(du -hs ./.usr.*fs | cut -f1) are used by /usr after compression"
    9.46 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \
    9.47 -	  bin/killall5 bin/seq bin/find bin/xargs bin/patch; do
    9.48 -  [ -e $ii ] || ln -s busybox $ii
    9.49 -done
    9.50 -[ -e bin/vcsa2txt ] || ln -s busybox bin/conspy
    9.51 -echo .usr.*fs | cpio -o -H newc > $1/rootfs.gz2
    9.52 -rm -f .usr.*fs