wok-next view slitaz-loram-http/receipt @ rev 3470

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