wok diff slitaz-loram-http/receipt @ rev 1330
Add pil
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 31 10:58:09 2008 +0000 (2008-08-31) |
parents | |
children | 3f49dc9f3e80 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/slitaz-loram-http/receipt Sun Aug 31 10:58:09 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 +}