# HG changeset patch # User Pascal Bellard # Date 1204975812 0 # Node ID fc9f573e8ac81d8cc6c4b219cffe8352df6c7576 # Parent c570ed86d31a0a0e01bfca5cc00092bf876a525f Slitaz-loram*: more flexible diff -r c570ed86d31a -r fc9f573e8ac8 slitaz-loram-cdrom/receipt --- a/slitaz-loram-cdrom/receipt Sat Mar 08 01:10:18 2008 +0000 +++ b/slitaz-loram-cdrom/receipt Sat Mar 08 11:30:12 2008 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="slitaz-loram-cdrom" -VERSION="1.0" +VERSION="1.1" CATEGORY="misc" SHORT_DESC="Rules to build low ram system using cdrom." MAINTAINER="pascal.bellard@slitaz.org" @@ -10,44 +10,55 @@ genpkg_rules() { mkdir -p $fs/etc/tazlito - cp stuff/loram.rootfs $fs/etc/tazlito + cp stuff/loram.* $fs/etc/tazlito } get_patch() { + local tag + local line + local i + tag="Handle kernel cmdline parameter config" + i=$(grep -n "$tag" /etc/init.d/rcS | cut -d: -f1) + i=$(($i-1)) + tag=$(grep "$tag" /etc/init.d/rcS) + if [ "$1" = "-R" ]; then + line="-$(($i-24)),26 +$(($i-24)),2" + i="-" + else + line="-$i,2 +$i,26" + i="+" + fi cat < /var/log/dmesg.log --/usr/bin/vcsa2txt < /dev/vcsa1 > /var/log/boot.log --/usr/bin/script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log -+busybox vcsa2txt < /dev/vcsa1 > /var/log/boot.log -+busybox script -a -q -c '/etc/init.d/rcS logged' /var/log/boot.log +@@ $line @@ -@@ -62,4 +62,4 @@ - # --DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` --if [ ! "`readlink /dev/cdrom`" ]; then -+DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | busybox cut -f 3` -+if [ ! "`busybox readlink /dev/cdrom`" ]; then - echo -n "Creating symlink : /dev/cdrom..." -@@ -87,2 +87,15 @@ - -+# Mount /usr -+if [ -d /cdrom ]; then -+ echo -n "Mounting /usr read-only from /cdrom... " -+ mount -o ro -t iso9660 /dev/cdrom /cdrom -+ if [ -f /cdrom/usr.sqfs ]; then -+ mount -o loop,ro -t squashfs /cdrom/usr.sqfs /usr -+ elif [ ! -L /usr ]; then -+ umount /cdrom -+ false -+ fi -+ status -+fi -+ - # Handle kernel cmdline parameter config=, to source a +$i# Mount /usr +$i if [ -d /cdrom ]; then +$i mount -o ro -t iso9660 /dev/cdrom /cdrom +$i if [ -d /.usr.rw -a -x /bin/funionfs ]; 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 if [ -f /cdrom/usr.cromfs ]; then +$i /bin/cromfs-driver /cdrom/usr.cromfs /\$usr +$i elif [ -f /cdrom/usr.sqfs ]; then +$i mount -o loop,ro -t squashfs /cdrom/usr.sqfs /\$usr +$i elif [ ! -L /\$usr ]; then +$i umount /cdrom +$i false +$i fi +$i status +$i if [ -d /.usr.rw -a -x /bin/funionfs ]; then +$i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr +$i fi +$i fi +$i + $tag EOF } @@ -67,5 +78,5 @@ # Pre remove commands for Tazpkg. pre_remove() { - [ -L /usr/bin/patch ] || get_patch | patch -R -p0 + get_patch -R | patch -p0 } diff -r c570ed86d31a -r fc9f573e8ac8 slitaz-loram-cdrom/stuff/loram.extract --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slitaz-loram-cdrom/stuff/loram.extract Sat Mar 08 11:30:12 2008 +0000 @@ -0,0 +1,32 @@ +# remove link to cdrom +[ -d cdrom ] && rmdir cdrom +rm -f bin/vcsa2txt bin/script bin/cut bin/readlink +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 + [ "${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 + [ "${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 diff -r c570ed86d31a -r fc9f573e8ac8 slitaz-loram-cdrom/stuff/loram.rootfs --- a/slitaz-loram-cdrom/stuff/loram.rootfs Sat Mar 08 01:10:18 2008 +0000 +++ b/slitaz-loram-cdrom/stuff/loram.rootfs Sat Mar 08 11:30:12 2008 +0000 @@ -16,14 +16,32 @@ ln -s /usr/.moved$ii .$ii done echo "$(du -hs /usr/.moved | cut -f1) have been moved into /usr" -if [ -x usr/sbin/mksquashfs ]; then +usr=usr +if [ -x bin/funionfs ]; then + usr=.usr.ro + mkdir .usr.ro .usr.rw + ln -s /.usr.ro/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 rm -rf usr mkdir usr else mv usr ../rootcd - ln -s /cdrom/usr usr + [ "$usr" = "usr" ] || rmdir $usr + ln -s /cdrom/usr $usr ln -s /bin ../rootcd/bin fi +for ii in bin/vcsa2txt bin/script bin/cut bin/readlink ; do + ln -s busybox $ii +done mkdir cdrom COMPRESSION="gzip" diff -r c570ed86d31a -r fc9f573e8ac8 slitaz-loram/receipt --- a/slitaz-loram/receipt Sat Mar 08 01:10:18 2008 +0000 +++ b/slitaz-loram/receipt Sat Mar 08 11:30:12 2008 +0000 @@ -11,29 +11,44 @@ genpkg_rules() { mkdir -p $fs/etc/tazlito - cp stuff/loram.rootfs $fs/etc/tazlito + cp stuff/loram.* $fs/etc/tazlito } get_patch() { + local tag + local line + local i + tag="Creat /dev/cdrom if needed" + i=$(grep -n "$tag" /etc/init.d/rcS | cut -d: -f1) + i=$(($i-1)) + tag=$(grep "$tag" /etc/init.d/rcS) + if [ "$1" = "-R" ]; then + line="-$(($i-13)),15 +$(($i-13)),2" + i="-" + else + line="-$i,2 +$i,15" + i="+" + fi cat <