wok view slitaz-loram-cdrom/receipt @ rev 530

Up: m4 (1.4.11) + libtool (2.2.2)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 09 16:09:44 2008 +0200 (2008-04-09)
parents 80bb089358ea
children 17481ec4d76e
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-loram-cdrom"
4 VERSION="1.1"
5 CATEGORY="misc"
6 SHORT_DESC="Rules to build low ram system using cdrom."
7 MAINTAINER="pascal.bellard@slitaz.org"
8 WEB_SITE="http://www.slitaz.org/"
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 set_patch()
18 {
19 local tag
20 local line
21 local i
22 tag="Handle kernel cmdline parameter config"
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-24)),26 +$(($i-24)),2"
28 i="-"
29 else
30 grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
31 line="-$i,2 +$i,26"
32 i="+"
33 fi
34 patch -p0 <<EOF
35 --- $1/etc/init.d/rcS
36 +++ $1/etc/init.d/rcS
37 @@ $line @@
39 $i# Mount /usr (from slitaz-loram-cdrom package)
40 $i if [ -d /cdrom ]; then
41 $i mount -o ro -t iso9660 /dev/cdrom /cdrom
42 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
43 $i echo -n "Mounting /usr read-write... "
44 $i usr=.usr.ro
45 $i else
46 $i echo -n "Mounting /usr read-only... "
47 $i usr=usr
48 $i fi
49 $i if [ -f /cdrom/usr.cromfs ]; then
50 $i /bin/cromfs-driver /cdrom/usr.cromfs /\$usr
51 $i elif [ -f /cdrom/usr.sqfs ]; then
52 $i mount -o loop,ro -t squashfs /cdrom/usr.sqfs /\$usr
53 $i elif [ ! -L /\$usr ]; then
54 $i umount /cdrom
55 $i false
56 $i fi
57 $i status
58 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
59 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
60 $i fi
61 $i fi
62 $i
63 $tag
64 EOF
65 chmod 0755 $1/etc/init.d/rcS
66 }
68 # Pre and post install commands for Tazpkg.
69 pre_install()
70 {
71 local i
72 . /etc/tazlito/tazlito.conf
73 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
74 [ "$i" = "$PACKAGE" ] && continue
75 yes y | tazpkg remove $i
76 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
77 done
78 }
80 post_install()
81 {
82 set_patch "$1"
83 if [ ! -x /bin/funionfs ]; then
84 cat <<EOF
85 ----
86 You will build a live CD with /usr mounted read-only.
87 You can install funionfs to have read-write access into /usr with:
89 # tazpkg get-install funionfs
91 EOF
92 fi
93 }
95 # Pre remove commands for Tazpkg.
96 pre_remove()
97 {
98 set_patch '' -R
99 }