wok-current view slitaz-loram/receipt @ rev 2058

Up lua (5.1.4), thanks mimas
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jan 21 10:34:09 2009 +0000 (2009-01-21)
parents bc8f5b69f71c
children 6509db5aa948
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram"
4 VERSION="1.4"
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 i
23 tag="/dev/cdrom if need"
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-25)),27 +$(($i-25)),2"
29 i="-"
30 else
31 grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return
32 line="-$i,2 +$i,27"
33 i="+"
34 fi
35 patch -p0 <<EOF
36 --- $1/etc/init.d/rcS
37 +++ $1/etc/init.d/rcS
38 @@ $line @@
40 $i# Mount compressed /usr (from slitaz-loram package)
41 $i if [ -f /.usr.cromfs -o -f /.usr.sqfs ]; then
42 $i usr=usr
43 $i echo -n "Mounting /usr read-"
44 $i if [ -d /.usr.rw ]; then
45 $i usr=.usr.ro
46 $i echo -n "write... "
47 $i else
48 $i echo -n "only... "
49 $i fi
50 $i if [ -f /.usr.cromfs ]; then
51 $i /bin/cromfs-driver /.usr.cromfs /\$usr -o ro,dev,suid,allow_other
52 $i else
53 $i /bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr
54 $i fi
55 $i if [ -d /.usr.rw ]; then
56 $i if [ -x bin/funionfs ]; then
57 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
58 $i else
59 $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
60 $i fi
61 $i fi
62 $i status
63 $i fi
64 $i
65 $tag
66 EOF
67 chmod 0755 $1/etc/init.d/rcS
68 }
70 # Pre and post install commands for Tazpkg.
71 pre_install()
72 {
73 local i
74 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
75 [ "$i" = "$PACKAGE" ] && continue
76 yes y | tazpkg remove $i
77 . /etc/tazlito/tazlito.conf
78 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
79 done
80 }
82 post_install()
83 {
84 set_patch "$1"
85 if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs ]; then
86 cat <<EOF
87 ----
88 You will build a live CD with /usr mounted read-only.
89 You can install aufs or funionfs to have read-write access into /usr with:
91 # tazpkg get-install aufs
92 or
93 # tazpkg get-install funionfs
95 EOF
96 fi
97 }
99 # Pre remove commands for Tazpkg.
100 pre_remove()
101 {
102 set_patch '' -R
103 }