wok-next view slitaz-loram/receipt @ rev 4382
Add ht
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Oct 14 11:55:42 2009 +0200 (2009-10-14) |
parents | 6509db5aa948 |
children | d9ddcc6d973c |
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram"
4 VERSION="1.5"
5 CATEGORY="misc"
6 SHORT_DESC="Rules to build low ram rootfs.gz."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 DEPENDS="slitaz-boot-scripts tazlito cromfs-or-squashfs"
9 WEB_SITE="http://www.slitaz.org/"
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="/dev/cdrom if need"
25 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
26 i=$(($i-1))
27 len=38
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 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# Mount compressed /usr (from slitaz-loram package)
43 $i while [ -f /.usr.cromfs -o -f /.usr.sqfs ]; do
44 $i usr=usr
45 $i echo -n "Mounting /usr read-"
46 $i if [ -d /.usr.rw ]; then
47 $i usr=.usr.ro
48 $i echo -n "write... "
49 $i else
50 $i echo -n "only... "
51 $i fi
52 $i FREEMEM=\$(busybox free | busybox awk '{ n = \$NF } END { print n }')
53 $i if grep -q " extract-loram" /proc/cmdline && [ \$FREEMEM -gt \\
54 $i \$(busybox du -s \$FS | busybox awk '{ print (\$1*4)+40000 }') ]; then
55 $i echo -n "Extracting loram..."
56 $i . /etc/tazlito/loram.extract
57 $i if status; then
58 $i yes y | tazpkg remove slitaz-loram > /dev/null
59 $i break
60 $i fi
61 $i fi
62 $i if [ -f /.usr.cromfs ]; then
63 $i /bin/cromfs-driver /.usr.cromfs /\$usr -o ro,dev,suid,allow_other
64 $i else
65 $i /bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr
66 $i fi
67 $i if [ -d /.usr.rw ]; then
68 $i if [ -x bin/funionfs ]; then
69 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
70 $i else
71 $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
72 $i fi
73 $i fi
74 $i status
75 $i break
76 $i done
77 $i
78 $tag
79 EOF
80 chmod 0755 $1/etc/init.d/rcS
81 }
83 # Pre and post install commands for Tazpkg.
84 pre_install()
85 {
86 local i
87 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
88 [ "$i" = "$PACKAGE" ] && continue
89 yes y | tazpkg remove $i
90 . /etc/tazlito/tazlito.conf
91 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
92 done
93 }
95 post_install()
96 {
97 set_patch "$1"
98 if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs ]; then
99 cat <<EOF
100 ----
101 You will build a live CD with /usr mounted read-only.
102 You can install aufs or funionfs to have read-write access into /usr with:
104 # tazpkg get-install aufs
105 or
106 # tazpkg get-install funionfs
108 EOF
109 fi
110 }
112 # Pre remove commands for Tazpkg.
113 pre_remove()
114 {
115 set_patch '' -R
116 }