# HG changeset patch # User Pascal Bellard # Date 1253303980 -7200 # Node ID 6509db5aa948a93b06704e03356ec53cbf8bad35 # Parent eda797775988138d13e279d992d99fa96f47cb8d slitaz-loram*: add extract-loram diff -r eda797775988 -r 6509db5aa948 slitaz-loram-cdrom/receipt --- a/slitaz-loram-cdrom/receipt Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram-cdrom/receipt Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="slitaz-loram-cdrom" -VERSION="1.4" +VERSION="1.5" CATEGORY="misc" SHORT_DESC="Rules to build low ram system using cdrom." MAINTAINER="pascal.bellard@slitaz.org" @@ -19,17 +19,19 @@ { local tag local line + local len local i tag="Handle kernel cmdline parameter config" i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) i=$(($i-1)) + len=87 tag=$(grep "$tag" $1/etc/init.d/rcS) if [ "$2" = "-R" ]; then - line="-$(($i-72)),74 +$(($i-72)),2" + line="-$(($i-$len+2)),$len +$(($i-$len+2)),2" i="-" else grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return - line="-$i,2 +$i,74" + line="-$i,2 +$i,$len" i="+" fi patch -p0 < /dev/null +$i return 0 +$i fi +$i fi $i cp -a \$FS /.usr.fs $i status $i echo -n "Releasing CD-ROM..." $i umount /cdrom $i FS=/.usr.fs -$i return 0 +$i if [ -d \$FS ]; then +$i rm -f /\$usr +$i mv \$FS /usr +$i fi $i fi $i return 1 $i } @@ -72,7 +89,7 @@ $i DEVICE="" $i fi $i fi -$i if [ -n "\$DEVICE" ]; then +$i while [ -n "\$DEVICE" ]; do $i if [ -d /.usr.rw ]; then $i echo -n "Mounting /usr read-write... " $i usr=.usr.ro @@ -82,18 +99,15 @@ $i fi $i FS=/cdrom\$DIR/usr.cromfs $i if [ -f \$FS ]; then -$i release_cdrom +$i release_cdrom && break $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other $i elif [ -f /cdrom\$DIR/usr.sqfs ]; then $i FS=/cdrom\$DIR/usr.sqfs -$i release_cdrom +$i release_cdrom && break $i mount -o loop,ro -t squashfs \$FS /\$usr $i elif [ -L /\$usr ]; then $i FS=/cdrom\$DIR/usr -$i if release_cdrom; then -$i rm -f /\$usr -$i mv \$FS /usr -$i fi +$i release_cdrom && break $i else $i umount /cdrom $i false @@ -106,7 +120,8 @@ $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr $i fi $i fi -$i fi +$i break +$i done $i fi $i $tag @@ -114,12 +129,13 @@ tag="/var/log/dmesg.log" i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) i=$(($i-1)) + len=9 tag=$(grep "$tag" $1/etc/init.d/rcS) if [ "$2" = "-R" ]; then - line="-$(($i-7)),9 +$(($i-7)),2" + line="-$(($i-$len+2)),$len +$(($i-$len+2)),2" i="-" else - line="-$i,2 +$i,9" + line="-$i,2 +$i,$len" i="+" fi patch -p0 < /dev/null +rmdir .usr* 2> /dev/null if [ -L usr ]; then rm usr cp -a $1/usr . @@ -9,7 +10,7 @@ rmdir usr rm -f bin/unmkcromfs cp -a $1/unmkcromfs bin/unmkcromfs - bin/unmkcromfs $packedfs usr + bin/unmkcromfs $packedfs usr > /dev/null [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs rm -f bin/cromfs-driver cp -a $1/cromfs-driver bin/cromfs-driver @@ -17,7 +18,7 @@ packedfs="$1/usr.sqfs" if [ -f $packedfs ]; then rmdir usr - sbin/unsquashfs -d usr $packedfs + sbin/unsquashfs -d usr $packedfs > /dev/null [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs fi if [ -d usr/.moved ]; then diff -r eda797775988 -r 6509db5aa948 slitaz-loram-cdrom/stuff/loram.rootfs --- a/slitaz-loram-cdrom/stuff/loram.rootfs Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram-cdrom/stuff/loram.rootfs Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,9 @@ echo "$(du -hs /usr | cut -f1) were used by /usr" -lib/ld-*.so --list ./sbin/insmod | grep /usr/lib | cut -d\ -f3 | \ -while read ii; do - mv .${ii%%.so.*}.so* ./lib +for j in insmod unmkcromfs unsquashfs ; do + lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\ -f3 | \ + while read ii; do + mv .${ii%%.so.*}.so* ./lib + done done for ii in /sbin /lib /bin; do mkdir -p ./usr/.moved$ii diff -r eda797775988 -r 6509db5aa948 slitaz-loram-http/receipt --- a/slitaz-loram-http/receipt Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram-http/receipt Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="slitaz-loram-http" -VERSION="1.1" +VERSION="1.5" CATEGORY="misc" SHORT_DESC="Rules to build low ram system using http." MAINTAINER="pascal.bellard@slitaz.org" @@ -19,17 +19,19 @@ { local tag local line + local len local i tag="Handle kernel cmdline parameter config" i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) i=$(($i-1)) + len=71 tag=$(grep "$tag" $1/etc/init.d/rcS) if [ "$2" = "-R" ]; then - line="-$(($i-52)),54 +$(($i-52)),2" + line="-$(($i-$len+2)),$len +$(($i-$len+2)),2" i="-" else grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return - line="-$i,2 +$i,54" + line="-$i,2 +$i,$len" i="+" fi patch -p0 < /dev/null +$i return 0 +$i fi +$i fi $i echo -n "Loading /usr in memory..." $i cp -a \$FS /.usr.fs $i status $i echo -n "Releasing HTTP link..." $i umount /cdrom && umount /cdrom $i FS=/.usr.fs -$i return 0 +$i if [ -d \$FS ]; then +$i rm -f /\$usr +$i mv \$FS /usr +$i fi $i fi $i return 1 $i } $i $i# Mount /usr (from slitaz-loram-http package) -$i if [ -d /cdrom ]; then +$i while [ -d /cdrom ]; do $i /etc/init.d/network.sh $i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')" $i URLISO=http://mirror.slitaz.org/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso @@ -71,15 +88,16 @@ $i fi $i FS=/cdrom/usr.cromfs $i if [ -f \$FS ]; then -$i release_http $i mkdir /\$usr +$i release_http && break $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other $i elif [ -f /cdrom/usr.sqfs ]; then $i FS=/cdrom/usr.sqfs -$i release_http $i mkdir /\$usr +$i release_http && break $i mount -o loop,ro -t squashfs \$FS /\$usr $i else +$i release_http && break $i FS=/cdrom/usr $i ln -s \$FS /\$usr $i fi @@ -87,7 +105,8 @@ $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr $i fi -$i fi +$i break +$i done $i $tag EOF diff -r eda797775988 -r 6509db5aa948 slitaz-loram-http/stuff/loram.extract --- a/slitaz-loram-http/stuff/loram.extract Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram-http/stuff/loram.extract Fri Sep 18 21:59:40 2009 +0200 @@ -1,5 +1,6 @@ # remove link to cdrom -[ -d cdrom ] && rmdir cdrom +[ -d cdrom ] && rmdir cdrom 2> /dev/null +rmdir .usr* 2> /dev/null if [ -L usr ]; then rm usr cp -a $1/usr . @@ -9,7 +10,7 @@ rmdir usr rm -f bin/unmkcromfs cp -a $1/unmkcromfs bin/unmkcromfs - bin/unmkcromfs $packedfs usr + bin/unmkcromfs $packedfs usr > /dev/null [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs rm -f bin/cromfs-driver cp -a $1/cromfs-driver bin/cromfs-driver @@ -17,7 +18,7 @@ packedfs="$1/usr.sqfs" if [ -f $packedfs ]; then rmdir usr - sbin/unsquashfs -d usr $packedfs + sbin/unsquashfs -d usr $packedfs > /dev/null [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs fi if [ -d usr/.moved ]; then diff -r eda797775988 -r 6509db5aa948 slitaz-loram-http/stuff/loram.rootfs --- a/slitaz-loram-http/stuff/loram.rootfs Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram-http/stuff/loram.rootfs Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,9 @@ echo "$(du -hs /usr | cut -f1) were used by /usr" -lib/ld-*.so --list ./sbin/insmod | grep /usr/lib | cut -d\ -f3 | \ -while read ii; do - mv .${ii%%.so.*}.so* ./lib +for j in insmod unmkcromfs unsquashfs ; do + lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\ -f3 | \ + while read ii; do + mv .${ii%%.so.*}.so* ./lib + done done for ii in /sbin /lib /bin; do mkdir -p ./usr/.moved$ii diff -r eda797775988 -r 6509db5aa948 slitaz-loram/receipt --- a/slitaz-loram/receipt Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram/receipt Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="slitaz-loram" -VERSION="1.4" +VERSION="1.5" CATEGORY="misc" SHORT_DESC="Rules to build low ram rootfs.gz." MAINTAINER="pascal.bellard@slitaz.org" @@ -19,17 +19,19 @@ { local tag local line + local len local i tag="/dev/cdrom if need" i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) i=$(($i-1)) + len=38 tag=$(grep "$tag" $1/etc/init.d/rcS) if [ "$2" = "-R" ]; then - line="-$(($i-25)),27 +$(($i-25)),2" + line="-$(($i-$len+2)),$len +$(($i-$len+2)),2" i="-" else grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return - line="-$i,2 +$i,27" + line="-$i,2 +$i,$len" i="+" fi patch -p0 < /dev/null +$i break +$i fi +$i fi $i if [ -f /.usr.cromfs ]; then $i /bin/cromfs-driver /.usr.cromfs /\$usr -o ro,dev,suid,allow_other $i else @@ -60,7 +72,8 @@ $i fi $i fi $i status -$i fi +$i break +$i done $i $tag EOF diff -r eda797775988 -r 6509db5aa948 slitaz-loram/stuff/loram.extract --- a/slitaz-loram/stuff/loram.extract Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram/stuff/loram.extract Fri Sep 18 21:59:40 2009 +0200 @@ -1,12 +1,13 @@ rmdir usr +rmdir .usr* 2> /dev/null packedfs=".usr.cromfs" if [ -f $packedfs ]; then - bin/unmkcromfs $packedfs usr + bin/unmkcromfs $packedfs usr > /dev/null rm -f $packedfs fi packedfs=".usr.sqfs" if [ -f $packedfs ]; then - sbin/unsquashfs -d usr $packedfs + sbin/unsquashfs -d usr $packedfs > /dev/null rm -f $packedfs fi ( cd usr/.moved ; find * -print ) | \ diff -r eda797775988 -r 6509db5aa948 slitaz-loram/stuff/loram.rootfs --- a/slitaz-loram/stuff/loram.rootfs Fri Sep 18 13:02:59 2009 +0200 +++ b/slitaz-loram/stuff/loram.rootfs Fri Sep 18 21:59:40 2009 +0200 @@ -1,7 +1,9 @@ echo "$(du -hs ./usr | cut -f1) were used by /usr" -lib/ld-*.so --list ./sbin/insmod | grep /usr/lib | cut -d\ -f3 | \ -while read ii; do - mv .${ii%%.so.*}.so* ./lib +for j in insmod unmkcromfs unsquashfs ; do + lib/ld-*.so --list *bin/$j 2> /dev/null | grep /usr/lib | cut -d\ -f3 | \ + while read ii; do + mv .${ii%%.so.*}.so* ./lib + done done for ii in /sbin /lib /bin; do mkdir -p ./usr/.moved$ii