wok-4.x rev 1290
Add slitaz-loram-http
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Aug 21 11:00:26 2008 +0000 (2008-08-21) |
parents | 710881595f59 |
children | 97f43001a79c |
files | slitaz-loram-http/receipt slitaz-loram-http/stuff/loram.extract slitaz-loram-http/stuff/loram.rootfs |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/slitaz-loram-http/receipt Thu Aug 21 11:00:26 2008 +0000 1.3 @@ -0,0 +1,126 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="slitaz-loram-http" 1.7 +VERSION="1.0" 1.8 +CATEGORY="misc" 1.9 +SHORT_DESC="Rules to build low ram system using http." 1.10 +MAINTAINER="pascal.bellard@slitaz.org" 1.11 +WEB_SITE="http://www.slitaz.org/" 1.12 +DEPENDS="httpfs-fuse funionfs" 1.13 + 1.14 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.15 +genpkg_rules() 1.16 +{ 1.17 + mkdir -p $fs/etc/tazlito 1.18 + cp stuff/loram.* $fs/etc/tazlito 1.19 +} 1.20 + 1.21 +set_patch() 1.22 +{ 1.23 + local tag 1.24 + local line 1.25 + local i 1.26 + tag="Handle kernel cmdline parameter config" 1.27 + i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) 1.28 + i=$(($i-1)) 1.29 + tag=$(grep "$tag" $1/etc/init.d/rcS) 1.30 + if [ "$2" = "-R" ]; then 1.31 + line="-$(($i-50)),52 +$(($i-50)),2" 1.32 + i="-" 1.33 + else 1.34 + grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return 1.35 + line="-$i,2 +$i,52" 1.36 + i="+" 1.37 + fi 1.38 + patch -p0 <<EOF 1.39 +--- $1/etc/init.d/rcS 1.40 ++++ $1/etc/init.d/rcS 1.41 +@@ $line @@ 1.42 + 1.43 +$i# Try to release http link (from slitaz-loram-http package) 1.44 +$i release_http() 1.45 +$i { 1.46 +$i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }') 1.47 +$i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then 1.48 +$i status 1.49 +$i echo -n "Loading /usr in memory..." 1.50 +$i cp -a \$FS /.usr.fs 1.51 +$i status 1.52 +$i echo -n "Releasing HTTP link..." 1.53 +$i umount /cdrom && umount /cdrom 1.54 +$i FS=/.usr.fs 1.55 +$i return 0 1.56 +$i fi 1.57 +$i return 1 1.58 +$i } 1.59 +$i 1.60 +$i# Mount /usr (from slitaz-loram-http package) 1.61 +$i if [ -d /cdrom ]; then 1.62 +$i /etc/init.d/network.sh 1.63 +$i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')" 1.64 +$i /bin/httpfs http://mirror.slitaz.org/iso/$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso /cdrom 1.65 +$i mount -o loop,ro /cdrom/*.iso /cdrom 1.66 +$i if [ -d /.usr.rw -a -x /bin/funionfs ]; then 1.67 +$i echo -n "Mounting /usr read-write... " 1.68 +$i usr=.usr.ro 1.69 +$i else 1.70 +$i echo -n "Mounting /usr read-only... " 1.71 +$i usr=usr 1.72 +$i fi 1.73 +$i FS=/cdrom/usr.cromfs 1.74 +$i if [ -f \$FS ]; then 1.75 +$i release_http 1.76 +$i mkdir /\$usr 1.77 +$i /bin/cromfs-driver \$FS /\$usr 1.78 +$i elif [ -f /cdrom/usr.sqfs ]; then 1.79 +$i FS=/cdrom/usr.sqfs 1.80 +$i release_http 1.81 +$i mkdir /\$usr 1.82 +$i mount -o loop,ro -t squashfs \$FS /\$usr 1.83 +$i else 1.84 +$i FS=/cdrom/usr 1.85 +$i ln -s \$FS /\$usr 1.86 +$i fi 1.87 +$i status 1.88 +$i if [ -d /.usr.rw -a -x /bin/funionfs ]; then 1.89 +$i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty NONE /usr 1.90 +$i fi 1.91 +$i fi 1.92 +$i 1.93 + $tag 1.94 +EOF 1.95 + chmod 0755 $1/etc/init.d/rcS 1.96 +} 1.97 + 1.98 +# Pre and post install commands for Tazpkg. 1.99 +pre_install() 1.100 +{ 1.101 + local i 1.102 + for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do 1.103 + [ "$i" = "$PACKAGE" ] && continue 1.104 + yes y | tazpkg remove $i 1.105 + . /etc/tazlito/tazlito.conf 1.106 + rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null 1.107 + done 1.108 +} 1.109 + 1.110 +post_install() 1.111 +{ 1.112 + set_patch "$1" 1.113 + if [ ! -x $1/bin/funionfs ]; then 1.114 + cat <<EOF 1.115 +---- 1.116 +You will build a live CD with /usr mounted read-only. 1.117 +You can install funionfs to have read-write access into /usr with: 1.118 + 1.119 +# tazpkg get-install funionfs 1.120 + 1.121 +EOF 1.122 + fi 1.123 +} 1.124 + 1.125 +# Pre remove commands for Tazpkg. 1.126 +pre_remove() 1.127 +{ 1.128 + set_patch '' -R 1.129 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/slitaz-loram-http/stuff/loram.extract Thu Aug 21 11:00:26 2008 +0000 2.3 @@ -0,0 +1,46 @@ 2.4 +# remove link to cdrom 2.5 +[ -d cdrom ] && rmdir cdrom 2.6 +rm -f bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free 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 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 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
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/slitaz-loram-http/stuff/loram.rootfs Thu Aug 21 11:00:26 2008 +0000 3.3 @@ -0,0 +1,40 @@ 3.4 +echo "$(du -hs /usr | cut -f1) were used by /usr" 3.5 +lib/ld-*.so --list ./sbin/insmod | grep /usr/lib | cut -d\ -f3 | \ 3.6 +while read ii; do 3.7 + mv .${ii%%.so.*}.so* ./lib 3.8 +done 3.9 +for ii in /sbin /lib /bin; do 3.10 + mkdir -p ./usr/.moved$ii 3.11 + for j in e2fsprogs pcmciautils cpio syslinux-extra isapnptools ncurses \ 3.12 + libcap; do 3.13 + for k in $(grep -s ^$ii /var/lib/tazpkg/installed/$j/files.list) ; do 3.14 + [ -f .$k ] || continue 3.15 + mv .$k ./usr/.moved$k 3.16 + ln -s /usr/.moved$k .$k 3.17 + done 3.18 + done 3.19 +done 3.20 +k="$(ls /lib/libp*.so /lib/librt*)" 3.21 +[ -x /bin/funionfs ] && k="" 3.22 +for ii in /var/lib/tazpkg/installed /lib/modules/*/kernel/drivers/net \ 3.23 + /lib/modules/*/kernel/sound /sbin/depmod /sbin/modinfo /bin/lsmod \ 3.24 + /lib/libnss_[^d]* $k; do 3.25 + [ -L .$ii ] && continue 3.26 + j=$(dirname /usr/.moved$ii) 3.27 + mkdir -p .$j 3.28 + mv .$ii .$j 3.29 + ln -s /usr/.moved$ii .$ii 3.30 +done 3.31 +echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr" 3.32 +mv usr/bin/httpfs bin 3.33 +cp usr/lib/libfuse.so.2.* lib/libfuse.so.2 3.34 +mv usr/share/udhcpc/default.script . 3.35 +rm -rf usr 3.36 +mkdir -p usr/share/udhcpc 3.37 +mv default.script usr/share/udhcpc 3.38 +ln -s /cdrom/boot boot 3.39 +for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free; do 3.40 + ln -s busybox $ii 3.41 +done 3.42 +mkdir cdrom .usr.rw 3.43 +COMPRESSION="gzip"