wok-6.x view slitaz-loram-http/receipt @ rev 4490

Add xorg-xf86-video-v4l
author Rohit Joshi <jozee@slitaz.org>
date Wed Nov 18 12:40:58 2009 +0000 (2009-11-18)
parents b78e1aa035a3
children fd85055f79db
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram-http"
4 VERSION="1.5"
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 len
23 local i
24 tag="Handle kernel cmdline parameter config"
25 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
26 i=$(($i-1))
27 len=73
28 tag=$(grep "$tag" $1/etc/init.d/rcS)
29 if [ "$2" = "-R" ]; then
30 line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
31 i="-"
32 else
33 grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return
34 line="-$i,2 +$i,$len"
35 i="+"
36 fi
37 busybox patch -p0 <<EOF
38 --- $1/etc/init.d/rcS
39 +++ $1/etc/init.d/rcS
40 @@ $line @@
42 $i# Try to release http link (from slitaz-loram-http package)
43 $i release_http()
44 $i {
45 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
46 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
47 $i status
48 $i if grep -q " extract-loram" /proc/cmdline &&
49 $i [ -d \$FS -o \$FREEMEM -gt \$(du -s \$FS | \\
50 $i awk '{ print (\$1*4)+40000 }') ]; then
51 $i echo -n "Extracting loram..."
52 $i . /etc/tazlito/loram.extract /cdrom
53 $i if status; then
54 $i umount /cdrom && umount /cdrom
55 $i rmdir /cdrom
56 $i yes y | tazpkg remove slitaz-loram-http > /dev/null
57 $i return 0
58 $i fi
59 $i fi
60 $i echo -n "Loading /usr in memory..."
61 $i cp -a \$FS /.usr.fs
62 $i status
63 $i echo -n "Releasing HTTP link..."
64 $i umount /cdrom && umount /cdrom
65 $i FS=/.usr.fs
66 $i if [ -d \$FS ]; then
67 $i rm -f /\$usr
68 $i mv \$FS /usr
69 $i fi
70 $i fi
71 $i return 1
72 $i }
73 $i
74 $i# Mount /usr (from slitaz-loram-http package)
75 $i while [ -d /cdrom ]; do
76 $i /etc/init.d/network.sh
77 $i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')"
78 $i URLISO=http://mirror.slitaz.org/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso,http://download.tuxfamily.org/slitaz/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso,http://slitaz.c3sl.ufpr.br/iso/\$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso
79 $i grep -q " urliso=" /proc/cmdline && URLISO=\$(cat /proc/cmdline | sed 's/.* urliso=\([^ ]*\).*/\1/'),\$URLISO
80 $i for i in \$(echo \$URLISO | sed 's/,/ /g'); do
81 $i /bin/httpfs \$URLISO /cdrom && break
82 $i done
83 $i mount -o loop,ro /cdrom/*.iso /cdrom
84 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
85 $i echo -n "Mounting /usr read-write... "
86 $i usr=.usr.ro
87 $i else
88 $i echo -n "Mounting /usr read-only... "
89 $i usr=usr
90 $i fi
91 $i FS=/cdrom/usr.cromfs
92 $i if [ -f \$FS ]; then
93 $i mkdir /\$usr
94 $i release_http && break
95 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
96 $i elif [ -f /cdrom/usr.sqfs ]; then
97 $i FS=/cdrom/usr.sqfs
98 $i mkdir /\$usr
99 $i release_http && break
100 $i mount -o loop,ro -t squashfs \$FS /\$usr
101 $i else
102 $i release_http && break
103 $i FS=/cdrom/usr
104 $i ln -s \$FS /\$usr
105 $i fi
106 $i status
107 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
108 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr
109 $i fi
110 $i break
111 $i done
112 $i
113 $tag
114 EOF
115 chmod 0755 $1/etc/init.d/rcS
116 }
118 # Pre and post install commands for Tazpkg.
119 pre_install()
120 {
121 local i
122 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
123 [ "$i" = "$PACKAGE" ] && continue
124 yes y | tazpkg remove $i
125 . /etc/tazlito/tazlito.conf
126 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
127 done
128 }
130 post_install()
131 {
132 set_patch "$1"
133 if [ ! -x $1/bin/funionfs ]; then
134 cat <<EOF
135 ----
136 You will build a live CD with /usr mounted read-only.
137 You can install funionfs to have read-write access into /usr with:
139 # tazpkg get-install funionfs
141 EOF
142 fi
143 }
145 # Pre remove commands for Tazpkg.
146 pre_remove()
147 {
148 set_patch '' -R
149 }