wok-6.x view slitaz-loram-http/receipt @ rev 1474
Up mpfr-dev (2.3.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 04 12:49:35 2008 +0000 (2008-10-04) |
parents | 755c0e3c3a53 |
children | 7141c42c3aa0 |
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="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-50)),52 +$(($i-50)),2"
29 i="-"
30 else
31 grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return
32 line="-$i,2 +$i,52"
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 /bin/httpfs http://mirror.slitaz.org/iso/$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso /cdrom
62 $i mount -o loop,ro /cdrom/*.iso /cdrom
63 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
64 $i echo -n "Mounting /usr read-write... "
65 $i usr=.usr.ro
66 $i else
67 $i echo -n "Mounting /usr read-only... "
68 $i usr=usr
69 $i fi
70 $i FS=/cdrom/usr.cromfs
71 $i if [ -f \$FS ]; then
72 $i release_http
73 $i mkdir /\$usr
74 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
75 $i elif [ -f /cdrom/usr.sqfs ]; then
76 $i FS=/cdrom/usr.sqfs
77 $i release_http
78 $i mkdir /\$usr
79 $i mount -o loop,ro -t squashfs \$FS /\$usr
80 $i else
81 $i FS=/cdrom/usr
82 $i ln -s \$FS /\$usr
83 $i fi
84 $i status
85 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
86 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr
87 $i fi
88 $i fi
89 $i
90 $tag
91 EOF
92 chmod 0755 $1/etc/init.d/rcS
93 }
95 # Pre and post install commands for Tazpkg.
96 pre_install()
97 {
98 local i
99 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
100 [ "$i" = "$PACKAGE" ] && continue
101 yes y | tazpkg remove $i
102 . /etc/tazlito/tazlito.conf
103 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
104 done
105 }
107 post_install()
108 {
109 set_patch "$1"
110 if [ ! -x $1/bin/funionfs ]; then
111 cat <<EOF
112 ----
113 You will build a live CD with /usr mounted read-only.
114 You can install funionfs to have read-write access into /usr with:
116 # tazpkg get-install funionfs
118 EOF
119 fi
120 }
122 # Pre remove commands for Tazpkg.
123 pre_remove()
124 {
125 set_patch '' -R
126 }