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

linux: package all splited pkgs with genpkg_rules
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 06 12:20:08 2008 +0200 (2008-06-06)
parents be1ec018b4bd
children 1c1dad96a8f3
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"
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="Creat /dev/cdrom if needed"
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-21)),23 +$(($i-21)),2"
29 i="-"
30 else
31 grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return
32 line="-$i,2 +$i,23"
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
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 /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
57 $i fi
58 $i status
59 $i fi
60 $i
61 $tag
62 EOF
63 chmod 0755 $1/etc/init.d/rcS
64 }
66 # Pre and post install commands for Tazpkg.
67 pre_install()
68 {
69 local i
70 . /etc/tazlito/tazlito.conf
71 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
72 [ "$i" = "$PACKAGE" ] && continue
73 yes y | tazpkg remove $i
74 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
75 done
76 }
78 post_install()
79 {
80 set_patch "$1"
81 if [ ! -x /bin/funionfs ]; then
82 cat <<EOF
83 ----
84 You will build a live CD with /usr mounted read-only.
85 You can install funionfs to have read-write access into /usr with:
87 # tazpkg get-install funionfs
89 EOF
90 fi
91 }
93 # Pre remove commands for Tazpkg.
94 pre_remove()
95 {
96 set_patch '' -R
97 }