wok view slitaz-loram-cdrom/receipt @ rev 377
Slitaz-loram*: fix /etc/init.d/rcS perms
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 08 16:39:00 2008 +0100 (2008-03-08) |
parents | 6909e27a7f91 |
children | c9546c686c60 |
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 'if [ -d /cdrom ]; then' $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
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 $loram
71 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null)
72 [ -n "$loram" -a "$loram" != "$PACKAGE" ] && yes y | tazpkg remove $loram
73 }
75 post_install()
76 {
77 local root
78 root=$1
79 set_patch "$root"
80 if [ ! -x /bin/funionfs ]; then
81 cat <<EOF
82 You will build a live CD with /usr mounted read-only.
83 You can install funionfs to have read-write access to /usr with:
84 # tazpkg get-install funionfs
85 EOF
86 fi
87 }
89 # Pre remove commands for Tazpkg.
90 pre_remove()
91 {
92 set_patch '' -R
93 }