wok-6.x rev 14519
Up slitaz-loram-http (2.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu May 16 18:42:06 2013 +0200 (2013-05-16) |
parents | dc87133e6b53 |
children | 921a41361c06 |
files | slitaz-loram-http/receipt slitaz-loram-http/stuff/loram.extract slitaz-loram-http/stuff/loram.final slitaz-loram-http/stuff/loram.rootfs |
line diff
1.1 --- a/slitaz-loram-http/receipt Thu May 16 11:25:56 2013 +0000 1.2 +++ b/slitaz-loram-http/receipt Thu May 16 18:42:06 2013 +0200 1.3 @@ -1,12 +1,12 @@ 1.4 # SliTaz package receipt. 1.5 1.6 PACKAGE="slitaz-loram-http" 1.7 -VERSION="1.6" 1.8 +VERSION="2.0" 1.9 CATEGORY="misc" 1.10 SHORT_DESC="Rules to build low ram system using http." 1.11 MAINTAINER="pascal.bellard@slitaz.org" 1.12 WEB_SITE="http://www.slitaz.org/" 1.13 -DEPENDS="slitaz-boot-scripts tazlito httpfs-fuse funionfs" 1.14 +DEPENDS="" 1.15 1.16 # Rules to gen a SliTaz package suitable for Tazpkg. 1.17 genpkg_rules() 1.18 @@ -14,165 +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=89 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-http 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 http link (from slitaz-loram-http package) 1.48 -$i release_http() 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 status 1.53 -$i if ! grep -q " keep-loram" /proc/cmdline && 1.54 -$i [ -d \$FS -o \$FREEMEM -gt \$(du -s \$FS | \\ 1.55 -$i awk '{ print (\$1*4)+40000 }') ]; then 1.56 -$i echo -n "Extracting loram..." 1.57 -$i . /etc/tazlito/loram.extract /cdrom 1.58 -$i if status; then 1.59 -$i umount /cdrom && umount /cdrom 1.60 -$i rmdir /cdrom 1.61 -$i yes y | tazpkg remove slitaz-loram-http > /dev/null 1.62 -$i return 0 1.63 -$i fi 1.64 -$i fi 1.65 -$i echo -n "Loading /usr in memory..." 1.66 -$i cp -a \$FS /.usr.fs 1.67 -$i status 1.68 -$i echo -n "Releasing HTTP link..." 1.69 -$i umount /cdrom && umount /cdrom 1.70 -$i FS=/.usr.fs 1.71 -$i if [ -d \$FS ]; then 1.72 -$i rm -f /\$usr 1.73 -$i mv \$FS /usr 1.74 -$i fi 1.75 -$i fi 1.76 -$i return 1 1.77 -$i } 1.78 -$i 1.79 -$i# Mount /usr (from slitaz-loram-http package) 1.80 -$i while [ -d /cdrom ]; do 1.81 -$i /etc/init.d/network.sh 1.82 -$i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')" 1.83 -$i release=\$(cat /etc/slitaz-release) 1.84 -$i iso1=iso/\$release/flavors/slitaz-\$release-loram-cdrom.iso 1.85 -$i iso2=iso/\$release/flavors/slitaz-loram-cdrom.iso 1.86 -$i URLISO=http://mirror.slitaz.org/\$iso1,http://mirror.slitaz.org/\$iso2,http://download.tuxfamily.org/slitaz/\$iso1,http://download.tuxfamily.org/slitaz/\$iso2,http://slitaz.c3sl.ufpr.br/\$iso1,http://slitaz.c3sl.ufpr.br/\$iso2 1.87 -$i grep -q " urliso=" /proc/cmdline && URLISO=\$(cat /proc/cmdline | sed 's/.* urliso=\([^ ]*\).*/\1/'),\$URLISO 1.88 -$i for i in \$(echo \$URLISO | sed 's/,/ /g'); do 1.89 -$i /bin/httpfs \$i /cdrom && break 1.90 -$i done 1.91 -$i mount -o loop,ro /cdrom/*.iso /cdrom 1.92 -$i if [ -d /.usr.rw -a -x /bin/funionfs ]; then 1.93 -$i echo -n "Mounting /usr read-write... " 1.94 -$i usr=.usr.ro 1.95 -$i else 1.96 -$i echo -n "Mounting /usr read-only... " 1.97 -$i usr=usr 1.98 -$i fi 1.99 -$i FS=/cdrom/usr.cromfs 1.100 -$i if [ -f \$FS ]; then 1.101 -$i mkdir /\$usr 1.102 -$i ln -s /usr/.moved /.moved 1.103 -$i release_http && break 1.104 -$i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other 1.105 -$i elif grep -q squashfs /etc/filesystems && [ -f /cdrom/usr.sqfs ]; then 1.106 -$i FS=/cdrom/usr.sqfs 1.107 -$i ln -s /usr/.moved /.moved 1.108 -$i mkdir /\$usr 1.109 -$i release_http && break 1.110 -$i mount -o loop,ro -t squashfs \$FS /\$usr 1.111 -$i elif grep -q squashfs /etc/filesystems && [ -f /cdrom/rootfs.gz ]; then 1.112 -$i FS=/cdrom/rootfs.gz 1.113 -$i ln -s /.rootfs /.moved 1.114 -$i mkdir /.rootfs 1.115 -$i release_http && break 1.116 -$i mount -o loop,ro -t squashfs \$FS /.rootfs 1.117 -$i ln -s /.rootfs/usr /\$usr 1.118 -$i elif [ -d /cdrom/usr ]; then 1.119 -$i FS=/cdrom/usr 1.120 -$i ln -s /usr/.moved /.moved 1.121 -$i rm -rf /\$usr && ln -s \$FS /\$usr 1.122 -$i else 1.123 -$i FS=/cdrom/fs/usr 1.124 -$i ln -s /cdrom/fs /.moved 1.125 -$i rm -rf /\$usr && ln -s \$FS /\$usr 1.126 -$i fi 1.127 -$i status 1.128 -$i if [ -d /.usr.rw -a -x /bin/funionfs ]; then 1.129 -$i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr 1.130 -$i fi 1.131 -$i break 1.132 -$i done 1.133 -$i 1.134 - $tag 1.135 -EOF 1.136 - chmod 0755 $1/etc/init.d/rcS 1.137 -} 1.138 - 1.139 -# Pre and post install commands for Tazpkg. 1.140 -pre_install() 1.141 -{ 1.142 - local i 1.143 - for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do 1.144 - [ "$i" = "$PACKAGE" ] && continue 1.145 - yes y | tazpkg remove $i 1.146 - . /etc/tazlito/tazlito.conf 1.147 - rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null 1.148 - done 1.149 -} 1.150 - 1.151 -post_install() 1.152 -{ 1.153 - set_patch "$1" 1.154 - 1.155 - # Don't support FAST_BOOT_X yet 1.156 - sed -i 's/FAST_BOOT_X=.*/FAST_BOOT_X="no"/' $1/etc/rcS.conf 1.157 - 1.158 - cat <<EOF 1.159 ----- 1.160 -'tazlito gen-distro' will create a loram-http flavor 1.161 -while this package is installed. 1.162 -EOF 1.163 - if [ ! -x $1/bin/funionfs ]; then 1.164 - cat <<EOF 1.165 ----- 1.166 -You will build a live CD with /usr mounted read-only. 1.167 -You can install funionfs to have read-write access into /usr with: 1.168 - 1.169 -# tazpkg get-install funionfs 1.170 - 1.171 -EOF 1.172 - fi 1.173 -} 1.174 - 1.175 -# Pre remove commands for Tazpkg. 1.176 -pre_remove() 1.177 -{ 1.178 - set_patch '' -R 1.179 - cat <<EOF 1.180 ----- 1.181 -'tazlito gen-distro' will work as expected now. 1.182 -EOF 1.183 -}
2.1 --- a/slitaz-loram-http/stuff/loram.extract Thu May 16 11:25:56 2013 +0000 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,52 +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 .moved ]; then 2.28 - ( cd .moved ; find * -print ) | \ 2.29 - while read file; do 2.30 - [ -L "$file" ] || continue 2.31 - rm -f "$file" 2.32 - mv ".moved/$file" "$file" 2.33 - done 2.34 - rm -rf usr/.moved 2> /dev/null 2.35 - rm -f .moved 2.36 -fi 2.37 -for ii in lib/libz.so lib/libstdc++.so lib/libgcc_s.so; do 2.38 - [ -e $ii ] && mv $ii* usr/lib/ 2.39 -done 2.40 -if [ -L root ]; then 2.41 - rm -f etc/keymap.conf etc/locale.conf etc/resolv.conf etc/TZ etc/motd 2.42 - [ -d var/log.ORG ] && mv -f var/log.ORG var/log 2.43 - [ -d var/run.ORG ] && mv -f var/run.ORG var/run 2.44 - [ -d var/lock.ORG ] && mv -f var/lock.ORG var/lock 2.45 - [ -d root.ORG ] && mv -f root.ORG root 2.46 - rm -f media/cdrom 2.47 - rmdir mnt/target 2.48 - sed -i 's/CLEAN_UP_SYSTEM="no"/CLEAN_UP_SYSTEM="yes"/' etc/rcS.conf 2.49 - sed -i 's/RUN_DAEMONS="/RUN_DAEMONS="slim /' etc/rcS.conf 2.50 -fi 2.51 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \ 2.52 - bin/killall5 bin/seq bin/find bin/xargs bin/patch; do 2.53 - [ -e usr/$ii ] && rm -f $ii 2.54 -done 2.55 -[ -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-http/stuff/loram.final Thu May 16 18:42:06 2013 +0200 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/http iso..." 3.8 + yes y | tazlito build-loram $iso $iso.$$ http 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-http/stuff/loram.rootfs Thu May 16 11:25:56 2013 +0000 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,42 +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 /.moved$k .$k 4.19 - done 4.20 - done 4.21 -done 4.22 -for ii in /var/lib/tazpkg/installed /lib/modules/*/kernel/drivers/net \ 4.23 - /lib/modules/*/kernel/sound /sbin/depmod /sbin/modinfo /sbin/lsmod \ 4.24 - /lib/libnss_c* ; do 4.25 - [ -L .$ii ] && continue 4.26 - j=$(dirname /usr/.moved$ii) 4.27 - mkdir -p .$j 4.28 - mv .$ii .$j 4.29 - ln -s /.moved$ii .$ii 4.30 -done 4.31 -echo "$(du -hs ./usr/.moved | cut -f1) have been moved into /usr" 4.32 -mv usr/bin/httpfs bin 4.33 -cp usr/lib/libfuse.so.2.* lib/libfuse.so.2 4.34 -mv usr/share/udhcpc/default.script . 4.35 -rm -rf usr 4.36 -mkdir -p usr/share/udhcpc 4.37 -mv default.script usr/share/udhcpc 4.38 -ln -s /cdrom/boot boot 4.39 -for ii in bin/vcsa2txt bin/awk bin/script bin/cut bin/readlink bin/du bin/free \ 4.40 - bin/killall5 bin/seq bin/find bin/xargs bin/patch; do 4.41 - [ -e $ii ] || ln -s busybox $ii 4.42 -done 4.43 -[ -e bin/vcsa2txt ] || ln -s busybox bin/conspy 4.44 -mkdir cdrom .usr.rw 4.45 -COMPRESSION="gzip"