wok-stable annotate slitaz-loram-http/receipt @ rev 2297

Up: udev (138)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 22 22:45:38 2009 +0100 (2009-02-22)
parents 7141c42c3aa0
children bf6b4e59baf3
rev   line source
pascal@1290 1 # SliTaz package receipt.
pascal@1290 2
pascal@1290 3 PACKAGE="slitaz-loram-http"
pascal@1339 4 VERSION="1.1"
pascal@1290 5 CATEGORY="misc"
pascal@1290 6 SHORT_DESC="Rules to build low ram system using http."
pascal@1290 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@1290 8 WEB_SITE="http://www.slitaz.org/"
pascal@1964 9 DEPENDS="slitaz-boot-scripts tazlito httpfs-fuse funionfs"
pascal@1290 10
pascal@1290 11 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1290 12 genpkg_rules()
pascal@1290 13 {
pascal@1290 14 mkdir -p $fs/etc/tazlito
pascal@1290 15 cp stuff/loram.* $fs/etc/tazlito
pascal@1290 16 }
pascal@1290 17
pascal@1290 18 set_patch()
pascal@1290 19 {
pascal@1290 20 local tag
pascal@1290 21 local line
pascal@1290 22 local i
pascal@1290 23 tag="Handle kernel cmdline parameter config"
pascal@1290 24 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
pascal@1290 25 i=$(($i-1))
pascal@1290 26 tag=$(grep "$tag" $1/etc/init.d/rcS)
pascal@1290 27 if [ "$2" = "-R" ]; then
pascal@1963 28 line="-$(($i-52)),54 +$(($i-52)),2"
pascal@1290 29 i="-"
pascal@1290 30 else
pascal@1290 31 grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return
pascal@1963 32 line="-$i,2 +$i,54"
pascal@1290 33 i="+"
pascal@1290 34 fi
pascal@1290 35 patch -p0 <<EOF
pascal@1290 36 --- $1/etc/init.d/rcS
pascal@1290 37 +++ $1/etc/init.d/rcS
pascal@1290 38 @@ $line @@
pascal@1290 39
pascal@1290 40 $i# Try to release http link (from slitaz-loram-http package)
pascal@1290 41 $i release_http()
pascal@1290 42 $i {
pascal@1290 43 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
pascal@1290 44 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
pascal@1290 45 $i status
pascal@1290 46 $i echo -n "Loading /usr in memory..."
pascal@1290 47 $i cp -a \$FS /.usr.fs
pascal@1290 48 $i status
pascal@1290 49 $i echo -n "Releasing HTTP link..."
pascal@1290 50 $i umount /cdrom && umount /cdrom
pascal@1290 51 $i FS=/.usr.fs
pascal@1290 52 $i return 0
pascal@1290 53 $i fi
pascal@1290 54 $i return 1
pascal@1290 55 $i }
pascal@1290 56 $i
pascal@1290 57 $i# Mount /usr (from slitaz-loram-http package)
pascal@1290 58 $i if [ -d /cdrom ]; then
pascal@1290 59 $i /etc/init.d/network.sh
pascal@1290 60 $i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')"
pascal@1963 61 $i URLISO=http://mirror.slitaz.org/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso
pascal@1963 62 $i grep -q " urliso=" /proc/cmdline && URLISO=\$(cat /proc/cmdline | sed 's/.* urliso=\([^ ]*\).*/\1/')
pascal@1963 63 $i /bin/httpfs \$URLISO /cdrom
pascal@1290 64 $i mount -o loop,ro /cdrom/*.iso /cdrom
pascal@1290 65 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@1290 66 $i echo -n "Mounting /usr read-write... "
pascal@1290 67 $i usr=.usr.ro
pascal@1290 68 $i else
pascal@1290 69 $i echo -n "Mounting /usr read-only... "
pascal@1290 70 $i usr=usr
pascal@1290 71 $i fi
pascal@1290 72 $i FS=/cdrom/usr.cromfs
pascal@1290 73 $i if [ -f \$FS ]; then
pascal@1290 74 $i release_http
pascal@1290 75 $i mkdir /\$usr
pascal@1339 76 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
pascal@1290 77 $i elif [ -f /cdrom/usr.sqfs ]; then
pascal@1290 78 $i FS=/cdrom/usr.sqfs
pascal@1290 79 $i release_http
pascal@1290 80 $i mkdir /\$usr
pascal@1290 81 $i mount -o loop,ro -t squashfs \$FS /\$usr
pascal@1290 82 $i else
pascal@1290 83 $i FS=/cdrom/usr
pascal@1290 84 $i ln -s \$FS /\$usr
pascal@1290 85 $i fi
pascal@1290 86 $i status
pascal@1290 87 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@1339 88 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr
pascal@1290 89 $i fi
pascal@1290 90 $i fi
pascal@1290 91 $i
pascal@1290 92 $tag
pascal@1290 93 EOF
pascal@1290 94 chmod 0755 $1/etc/init.d/rcS
pascal@1290 95 }
pascal@1290 96
pascal@1290 97 # Pre and post install commands for Tazpkg.
pascal@1290 98 pre_install()
pascal@1290 99 {
pascal@1290 100 local i
pascal@1290 101 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
pascal@1290 102 [ "$i" = "$PACKAGE" ] && continue
pascal@1290 103 yes y | tazpkg remove $i
pascal@1290 104 . /etc/tazlito/tazlito.conf
pascal@1290 105 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
pascal@1290 106 done
pascal@1290 107 }
pascal@1290 108
pascal@1290 109 post_install()
pascal@1290 110 {
pascal@1290 111 set_patch "$1"
pascal@1290 112 if [ ! -x $1/bin/funionfs ]; then
pascal@1290 113 cat <<EOF
pascal@1290 114 ----
pascal@1290 115 You will build a live CD with /usr mounted read-only.
pascal@1290 116 You can install funionfs to have read-write access into /usr with:
pascal@1290 117
pascal@1290 118 # tazpkg get-install funionfs
pascal@1290 119
pascal@1290 120 EOF
pascal@1290 121 fi
pascal@1290 122 }
pascal@1290 123
pascal@1290 124 # Pre remove commands for Tazpkg.
pascal@1290 125 pre_remove()
pascal@1290 126 {
pascal@1290 127 set_patch '' -R
pascal@1290 128 }