wok view slitaz-loram-cdrom/receipt @ rev 390
Slitaz-loram-cdrom: decrease memory footprint a bit
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 09 13:00:33 2008 +0000 (2008-03-09) |
parents | c9546c686c60 |
children | e0ad9f116fca |
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"
9 # Rules to gen a SliTaz package suitable for Tazpkg.
10 genpkg_rules()
11 {
12 mkdir -p $fs/etc/tazlito
13 cp stuff/loram.* $fs/etc/tazlito
14 }
16 set_patch()
17 {
18 local tag
19 local line
20 local i
21 tag="Handle kernel cmdline parameter config"
22 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
23 i=$(($i-1))
24 tag=$(grep "$tag" $1/etc/init.d/rcS)
25 if [ "$2" = "-R" ]; then
26 line="-$(($i-24)),26 +$(($i-24)),2"
27 i="-"
28 else
29 grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
30 line="-$i,2 +$i,26"
31 i="+"
32 fi
33 patch -p0 <<EOF
34 --- $1/etc/init.d/rcS
35 +++ $1/etc/init.d/rcS
36 @@ $line @@
38 $i# Mount /usr (from slitaz-loram-cdrom package)
39 $i if [ -d /cdrom ]; then
40 $i mount -o ro -t iso9660 /dev/cdrom /cdrom
41 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
42 $i echo -n "Mounting /usr read-write... "
43 $i usr=.usr.ro
44 $i else
45 $i echo -n "Mounting /usr read-only... "
46 $i usr=usr
47 $i fi
48 $i if [ -f /cdrom/usr.cromfs ]; then
49 $i /bin/cromfs-driver /cdrom/usr.cromfs /\$usr
50 $i elif [ -f /cdrom/usr.sqfs ]; then
51 $i mount -o loop,ro -t squashfs /cdrom/usr.sqfs /\$usr
52 $i elif [ ! -L /\$usr ]; then
53 $i umount /cdrom
54 $i false
55 $i fi
56 $i status
57 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
58 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
59 $i fi
60 $i fi
61 $i
62 $tag
63 EOF
64 chmod 0755 $1/etc/init.d/rcS
65 }
67 # Pre and post install commands for Tazpkg.
68 pre_install()
69 {
70 local i
71 . /etc/tazlito/tazlito.conf
72 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
73 [ "$i" = "$PACKAGE" ] && continue
74 yes y | tazpkg remove $i
75 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
76 done
77 }
79 post_install()
80 {
81 set_patch "$1"
82 if [ ! -x /bin/funionfs ]; then
83 cat <<EOF
84 ----
85 You will build a live CD with /usr mounted read-only.
86 You can install funionfs to have read-write access into /usr with:
88 # tazpkg get-install funionfs
90 EOF
91 fi
92 }
94 # Pre remove commands for Tazpkg.
95 pre_remove()
96 {
97 set_patch '' -R
98 }