wok view slitaz-loram/receipt @ rev 375

Slitaz-loram*: do not remove itself during install...
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 08 13:55:02 2008 +0000 (2008-03-08)
parents 526c779c9331
children b3b7d8187bd1
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram"
4 VERSION="1.2"
5 CATEGORY="misc"
6 SHORT_DESC="Rules to build low ram rootfs.gz."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 DEPENDS="cromfs"
10 # Rules to gen a SliTaz package suitable for Tazpkg.
11 genpkg_rules()
12 {
13 mkdir -p $fs/etc/tazlito
14 cp stuff/loram.* $fs/etc/tazlito
15 }
17 get_patch()
18 {
19 local tag
20 local line
21 local i
22 tag="Creat /dev/cdrom if needed"
23 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
24 i=$(($i-1))
25 tag=$(grep "$tag" $1/etc/init.d/rcS)
26 if [ "$2" = "-R" ]; then
27 line="-$(($i-13)),15 +$(($i-13)),2"
28 i="-"
29 else
30 grep -q 'if [ -f /.usr.cromfs ]; then' $1/etc/init.d/rcS && return
31 line="-$i,2 +$i,15"
32 i="+"
33 fi
34 cat <<EOF
35 --- $1/etc/init.d/rcS
36 +++ $1/etc/init.d/rcS
37 @@ $line @@
39 $i# Mount compressed /usr
40 $i if [ -f /.usr.cromfs ]; then
41 $i if [ -d /.usr.rw ]; then
42 $i echo -n "Mounting compressed /usr read-write... "
43 $i /bin/cromfs-driver /.usr.cromfs /.usr.ro
44 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
45 $i else
46 $i echo -n "Mounting compressed /usr read-only... "
47 $i /bin/cromfs /.usr.cromfs /usr
48 $i fi
49 $i status
50 $i fi
51 $i
52 $tag
53 EOF
54 chmod 0755 $1/etc/init.d/rcS
55 }
57 # Pre and post install commands for Tazpkg.
58 pre_install()
59 {
60 local $loram
61 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null)
62 [ -n "$loram" -a "$loram" != "$PACKAGE" ] && yes y | tazpkg remove $loram
63 }
65 post_install()
66 {
67 local root
68 root=$1
69 get_patch "$root" | patch -p0
70 if [ ! -x /bin/funionfs ]; then
71 cat <<EOF
72 You will build a live CD with /usr mounted read-only.
73 You can install funionfs to have read-write access to /usr with:
74 # tazpkg get-install funionfs
75 EOF
76 fi
77 }
79 # Pre remove commands for Tazpkg.
80 pre_remove()
81 {
82 get_patch '' -R | patch -p0
83 }