# HG changeset patch # User Pascal Bellard # Date 1330875324 -3600 # Node ID f7cdbd605b686d1682a41818d99ace9efad4184e # Parent 7611f82bb0f58a59433504c91eb54aa27d1c9385 New style loram diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram-cdrom/receipt --- a/slitaz-loram-cdrom/receipt Sun Mar 04 09:52:39 2012 +0100 +++ b/slitaz-loram-cdrom/receipt Sun Mar 04 16:35:24 2012 +0100 @@ -1,12 +1,12 @@ # SliTaz package receipt. PACKAGE="slitaz-loram-cdrom" -VERSION="1.5" +VERSION="2.0" CATEGORY="misc" SHORT_DESC="Rules to build low ram system using cdrom." MAINTAINER="pascal.bellard@slitaz.org" WEB_SITE="http://www.slitaz.org/" -DEPENDS="slitaz-boot-scripts tazlito" +DEPENDS="" # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() @@ -14,192 +14,3 @@ mkdir -p $fs/etc/tazlito cp stuff/loram.* $fs/etc/tazlito } - -set_patch() -{ - 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=88 - tag=$(grep "$tag" $1/etc/init.d/rcS) - if [ "$2" = "-R" ]; then - 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,$len" - i="+" - fi - busybox 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 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-cdrom package) -$i if [ -d /cdrom ]; then -$i DEVICE=/dev/cdrom -$i DIR= -$i if grep -q " loram=" /proc/cmdline; then -$i DIR=\`cat /proc/cmdline | sed 's/.* loram=\([^ ]*\).*/\1/'\` -$i DEVICE=\${DIR%,*} -$i DIR=/\${DIR#*,} -$i fi -$i if ! /bin/mount -r \$DEVICE /cdrom; then -$i if echo \$DEVICE | grep -Eq "/dev/sd|UUID=|LABEL="; then -$i USBDELAY=\`cat /sys/module/usb_storage/parameters/delay_use\` -$i USBDELAY=\$((1+\$USBDELAY)) -$i echo "\$DEVICE is potentially a USB device: sleep for \$USBDELAY seconds" -$i sleep \$USBDELAY -$i fi -$i if ! /bin/mount -r \$DEVICE /cdrom; then -$i DEVICE="" -$i fi -$i fi -$i while [ -n "\$DEVICE" ]; do -$i if [ -d /.usr.rw ]; then -$i echo -n "Mounting /usr read-write... " -$i usr=.usr.ro -$i else -$i echo -n "Mounting /usr read-only... " -$i usr=usr -$i fi -$i FS=/cdrom\$DIR/usr.cromfs -$i if [ -f \$FS ]; then -$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 && break -$i mount -o loop,ro -t squashfs \$FS /\$usr -$i elif [ -L /\$usr ]; then -$i FS=/cdrom\$DIR/usr -$i release_cdrom && break -$i true -$i else -$i umount /cdrom -$i false -$i fi -$i status -$i if [ -d /.usr.rw ]; then -$i if [ -x /bin/funionfs ]; then -$i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr -$i else -$i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr -$i fi -$i fi -$i break -$i done -$i fi -$i - $tag -EOF - 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-$len+2)),$len +$(($i-$len+2)),2" - i="-" - else - line="-$i,2 +$i,$len" - i="+" - fi - busybox patch -p0 < /dev/null); do - [ "$i" = "$PACKAGE" ] && continue - yes y | tazpkg remove $i - . /etc/tazlito/tazlito.conf - rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null - done -} - -post_install() -{ - set_patch "$1" - - # Don't support FAST_BOOT_X yet - sed -i 's/FAST_BOOT_X=.*/FAST_BOOT_X="no"/' $1/etc/rcS.conf - - cat < /dev/null -rmdir .usr* 2> /dev/null -if [ -L usr ]; then - rm usr - cp -a $1/usr . -fi -packedfs="$1/usr.cromfs" -if [ -f $packedfs ]; then - rmdir usr - rm -f bin/unmkcromfs - cp -a $1/unmkcromfs bin/unmkcromfs - bin/unmkcromfs $packedfs usr > /dev/null - [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs - rm -f bin/cromfs-driver - cp -a $1/cromfs-driver bin/cromfs-driver -fi -packedfs="$1/usr.sqfs" -if [ -f $packedfs ]; then - rmdir usr - sbin/unsquashfs -d usr $packedfs > /dev/null - [ "${packedfs%%/*}" = ".." ] && rm -f $packedfs -fi -if [ -d usr/.moved ]; then - ( cd usr/.moved ; find * -print ) | \ - while read file; do - [ -L "$file" ] || continue - rm -f "$file" - mv "usr/.moved/$file" "$file" - done - rm -rf usr/.moved -fi -for ii in lib/libz.so lib/libstdc++.so lib/libgcc_s.so; do - [ -e $ii ] && mv $ii* usr/lib/ -done -if [ -L root ]; then - rm -f etc/keymap.conf etc/locale.conf etc/resolv.conf etc/TZ etc/motd - [ -d var/log.ORG ] && mv -f var/log.ORG var/log - [ -d var/run.ORG ] && mv -f var/run.ORG var/run - [ -d var/lock.ORG ] && mv -f var/lock.ORG var/lock - [ -d root.ORG ] && mv -f root.ORG root - rm -f media/cdrom - rmdir mnt/target - sed -i 's/CLEAN_UP_SYSTEM="no"/CLEAN_UP_SYSTEM="yes"/' etc/rcS.conf - sed -i 's/RUN_DAEMONS="/RUN_DAEMONS="slim /' etc/rcS.conf -fi -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \ - bin/killall5 bin/seq bin/find bin/xargs bin/patch; do - [ -e usr/$ii ] && rm -f $ii -done -[ -e usr/bin/vcsa2txt ] || rm -f bin/conspy diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram-cdrom/stuff/loram.final --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slitaz-loram-cdrom/stuff/loram.final Sun Mar 04 16:35:24 2012 +0100 @@ -0,0 +1,11 @@ +cd $1/.. +iso=$(ls *.iso) +if [ -s "$iso" ]; then + echo "Converting $iso to low ram/cdrom iso..." + yes y | tazlito build-loram $iso $iso.$$ cdrom + mv -f $iso.$$ $iso + md5sum $iso > ${iso%.iso}.md5 + echo "================================================================================" +fi +cd - > /dev/null + diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram-cdrom/stuff/loram.rootfs --- a/slitaz-loram-cdrom/stuff/loram.rootfs Sun Mar 04 09:52:39 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -echo "$(du -hs /usr | cut -f1) were used by /usr" -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 - for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \ - libcap; do - for k in $(grep -s ^$ii /var/lib/tazpkg/installed/$j/files.list) ; do - [ -f .$k ] || continue - mv .$k ./usr/.moved$k - ln -s /usr/.moved$k .$k - done - done -done -k="$(ls /lib/lib[rp]*.so)" -[ -x /bin/funionfs ] && k="$(ls /lib/libresolv*.so)" -for ii in /var/lib/tazpkg/installed /lib/modules/*/kernel/drivers/net \ - /lib/modules/*/kernel/sound /sbin/depmod /sbin/modinfo /sbin/lsmod \ - /lib/libns*.so $k; do - [ -L .$ii ] && continue - case "$ii" in - /lib/libnss_file*) continue;; - /lib/libpthread*) continue;; - esac - j=$(dirname /usr/.moved$ii) - mkdir -p .$j - mv .$ii .$j - ln -s /usr/.moved$ii .$ii -done -echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr" -usr=usr -if [ -x bin/funionfs -o -d /var/lib/tazpkg/installed/aufs-utils ]; then - usr=.usr.ro - mkdir .usr.ro .usr.rw -fi -if [ -x bin/funionfs -o -x usr/bin/mkcromfs ]; then - ln -s /$usr/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2 -fi -if [ -x usr/bin/mkcromfs ]; then - usr/bin/mkcromfs -qq -f 262144 -b 16384 usr ../rootcd/usr.cromfs - rm -rf usr - mkdir usr - for ii in unmkcromfs cromfs-driver ; do - mv bin/$ii ../rootcd - ln -s /cdrom/$ii bin/$ii - done -elif [ -x usr/sbin/mksquashfs ]; then - usr/sbin/mksquashfs usr ../rootcd/usr.sqfs -comp xz -Xbcj x86 - rm -rf usr - mkdir usr -else - mv usr ../rootcd - [ "$usr" = "usr" ] || mv $usr usr - ln -s /cdrom/usr $usr -fi -if [ -d ../rootcd/usr/lib ]; then - for ii in *; do - case "$ii" in - usr|boot|home) continue;; - mnt|media|sys|proc|cdrom) mkdir ../rootcd/$ii;; - *) cp -a $ii ../rootcd/$ii;; - esac - done - for ii in media/*; do - [ "$ii" = "media/cdrom" ] || mkdir ../rootcd/$ii - done - for ii in keymap.conf locale.conf resolv.conf TZ motd; do - rm -f ../rootcd/etc/$ii - ln -s /tmp/$ii ../rootcd/etc/$ii - done - ln -s /tmp/detected-modules ../rootcd/var/lib/detected-modules - for ii in log run lock; do - mv ../rootcd/var/$ii ../rootcd/var/$ii.ORG - ln -s /tmp ../rootcd/var/$ii - done - mv ../rootcd/root ../rootcd/root.ORG - ln -s /tmp ../rootcd/root - ln -s /tmp ../rootcd/home - ln -s / ../rootcd/media/cdrom - mkdir ../rootcd/mnt/target - sed -i 's/CLEAN_UP_SYSTEM="yes"/CLEAN_UP_SYSTEM="no"/' ../rootcd/etc/rcS.conf - sed -i 's/RUN_DAEMONS=.*/RUN_DAEMONS=""/' ../rootcd/etc/rcS.conf - for ii in ../rootcd/boot/isolinux/*.cfg; do - 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 - mv -f $ii.tmp $ii - done - cat >> ../rootcd/boot/isolinux/enopts.txt <> ../rootcd/boot/isolinux/options.txt < /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 -$i /bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr -$i fi -$i if [ -d /.usr.rw ]; then -$i if [ -x bin/funionfs ]; then -$i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr -$i else -$i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr -$i fi -$i fi -$i status -$i break -$i done -$i - $tag -EOF - chmod 0755 $1/etc/init.d/rcS -} - -# Pre and post install commands for Tazpkg. -pre_install() -{ - local i - for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do - [ "$i" = "$PACKAGE" ] && continue - yes y | tazpkg remove $i - . /etc/tazlito/tazlito.conf - rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null - done -} - -post_install() -{ - set_patch "$1" - cat < /dev/null -packedfs=".usr.cromfs" -if [ -f $packedfs ]; then - bin/unmkcromfs $packedfs usr > /dev/null - rm -f $packedfs -fi -packedfs=".usr.sqfs" -if [ -f $packedfs ]; then - sbin/unsquashfs -d usr $packedfs > /dev/null - rm -f $packedfs -fi -( cd usr/.moved ; find * -print ) | \ -while read file; do - [ -L "$file" ] || continue - rm -f "$file" - mv "usr/.moved/$file" "$file" -done -rm -rf usr/.moved -for ii in lib/libz.so lib/libstdc++.so lib/libgcc_s.so; do - [ -e $ii ] && mv $ii* usr/lib/ -done -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \ - bin/killall5 bin/seq bin/find bin/xargs bin/patch; do - [ -e usr/$ii ] && rm -f $ii -done -[ -e usr/bin/vcsa2txt ] || rm -f bin/conspy diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram/stuff/loram.final --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slitaz-loram/stuff/loram.final Sun Mar 04 16:35:24 2012 +0100 @@ -0,0 +1,11 @@ +cd $1/.. +iso=$(ls *.iso) +if [ -s "$iso" ]; then + echo "Converting $iso to low ram iso..." + yes y | tazlito build-loram $iso $iso.$$ + mv -f $iso.$$ $iso + md5sum $iso > ${iso%.iso}.md5 + echo "================================================================================" +fi +cd - > /dev/null + diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram/stuff/loram.iso --- a/slitaz-loram/stuff/loram.iso Sun Mar 04 09:52:39 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -if [ -s $1/rootfs.gz2 ]; then - local rem - rem=$(( $(stat -c "%s" $1/boot/rootfs.gz) % 4 )) - [ $rem -ne 0 ] && - dd if=/dev/zero bs=1 count=$(( 4 - $rem )) >> $1/boot/rootfs.gz - cat $1/rootfs.gz2 >> $1/boot/rootfs.gz - rm -f $1/rootfs.gz2 -fi diff -r 7611f82bb0f5 -r f7cdbd605b68 slitaz-loram/stuff/loram.rootfs --- a/slitaz-loram/stuff/loram.rootfs Sun Mar 04 09:52:39 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -echo "$(du -hs ./usr | cut -f1) were used by /usr" -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 - for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \ - libcap; do - for k in $(grep -s ^$ii ./var/lib/tazpkg/installed/$j/files.list) ; do - [ -f .$k ] || continue - mv .$k ./usr/.moved$k - ln -s /usr/.moved$k .$k - done - done -done -for ii in /var/lib/tazpkg/installed ; do - j=$(dirname /usr/.moved$ii) - mkdir -p .$j - mv .$ii .$j - ln -s /usr/.moved$ii .$ii -done -echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr" -echo "$(du -hs ./usr | cut -f1) were used by /usr before compression" -usr=usr -if [ -x usr/bin/mkcromfs ]; then - usr/bin/mkcromfs -qq -f 262144 -b 16384 usr .usr.cromfs -else - usr/sbin/mksquashfs usr .usr.sqfs -comp xz -Xbcj x86 -fi -if [ -x bin/funionfs -o -d /var/lib/tazpkg/installed/aufs-utils ]; then - mkdir .usr.rw .usr.ro - usr=.usr.ro -fi -if [ -x bin/funionfs -o -x usr/bin/mkcromfs ]; then - ln -s /$usr/lib/$(cd usr/lib ; ls libfuse.so.2.*) lib/libfuse.so.2 -fi -rm -rf usr -mkdir usr -echo "$(du -hs ./.usr.*fs | cut -f1) are used by /usr after compression" -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \ - bin/killall5 bin/seq bin/find bin/xargs bin/patch; do - [ -e $ii ] || ln -s busybox $ii -done -[ -e bin/vcsa2txt ] || ln -s busybox bin/conspy -echo .usr.*fs | cpio -o -H newc > $1/rootfs.gz2 -rm -f .usr.*fs