wok-current annotate slitaz-loram/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 |
rev | line source |
---|---|
pascal@229 | 1 # SliTaz package receipt. |
pascal@229 | 2 |
pascal@229 | 3 PACKAGE="slitaz-loram" |
pascal@369 | 4 VERSION="1.2" |
pascal@229 | 5 CATEGORY="misc" |
pascal@229 | 6 SHORT_DESC="Rules to build low ram rootfs.gz." |
pascal@229 | 7 MAINTAINER="pascal.bellard@slitaz.org" |
pascal@369 | 8 DEPENDS="cromfs" |
pascal@229 | 9 |
pascal@229 | 10 # Rules to gen a SliTaz package suitable for Tazpkg. |
pascal@229 | 11 genpkg_rules() |
pascal@229 | 12 { |
pascal@229 | 13 mkdir -p $fs/etc/tazlito |
pascal@370 | 14 cp stuff/loram.* $fs/etc/tazlito |
pascal@229 | 15 } |
pascal@229 | 16 |
pascal@377 | 17 set_patch() |
pascal@229 | 18 { |
pascal@370 | 19 local tag |
pascal@370 | 20 local line |
pascal@370 | 21 local i |
pascal@370 | 22 tag="Creat /dev/cdrom if needed" |
pascal@375 | 23 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) |
pascal@370 | 24 i=$(($i-1)) |
pascal@375 | 25 tag=$(grep "$tag" $1/etc/init.d/rcS) |
pascal@375 | 26 if [ "$2" = "-R" ]; then |
pascal@370 | 27 line="-$(($i-13)),15 +$(($i-13)),2" |
pascal@370 | 28 i="-" |
pascal@370 | 29 else |
pascal@375 | 30 grep -q 'if [ -f /.usr.cromfs ]; then' $1/etc/init.d/rcS && return |
pascal@370 | 31 line="-$i,2 +$i,15" |
pascal@370 | 32 i="+" |
pascal@370 | 33 fi |
pascal@377 | 34 patch -p0 <<EOF |
pascal@375 | 35 --- $1/etc/init.d/rcS |
pascal@375 | 36 +++ $1/etc/init.d/rcS |
pascal@370 | 37 @@ $line @@ |
pascal@229 | 38 |
pascal@370 | 39 $i# Mount compressed /usr |
pascal@370 | 40 $i if [ -f /.usr.cromfs ]; then |
pascal@370 | 41 $i if [ -d /.usr.rw ]; then |
pascal@370 | 42 $i echo -n "Mounting compressed /usr read-write... " |
pascal@370 | 43 $i /bin/cromfs-driver /.usr.cromfs /.usr.ro |
pascal@370 | 44 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr |
pascal@370 | 45 $i else |
pascal@370 | 46 $i echo -n "Mounting compressed /usr read-only... " |
pascal@370 | 47 $i /bin/cromfs /.usr.cromfs /usr |
pascal@370 | 48 $i fi |
pascal@370 | 49 $i status |
pascal@370 | 50 $i fi |
pascal@370 | 51 $i |
pascal@370 | 52 $tag |
pascal@229 | 53 EOF |
pascal@375 | 54 chmod 0755 $1/etc/init.d/rcS |
pascal@229 | 55 } |
pascal@229 | 56 |
pascal@229 | 57 # Pre and post install commands for Tazpkg. |
pascal@251 | 58 pre_install() |
pascal@251 | 59 { |
pascal@251 | 60 local $loram |
pascal@251 | 61 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null) |
pascal@375 | 62 [ -n "$loram" -a "$loram" != "$PACKAGE" ] && yes y | tazpkg remove $loram |
pascal@251 | 63 } |
pascal@251 | 64 |
pascal@229 | 65 post_install() |
pascal@229 | 66 { |
pascal@375 | 67 local root |
pascal@375 | 68 root=$1 |
pascal@377 | 69 set_patch "$root" |
pascal@371 | 70 if [ ! -x /bin/funionfs ]; then |
pascal@371 | 71 cat <<EOF |
pascal@371 | 72 You will build a live CD with /usr mounted read-only. |
pankso@374 | 73 You can install funionfs to have read-write access to /usr with: |
pascal@371 | 74 # tazpkg get-install funionfs |
pascal@371 | 75 EOF |
pascal@371 | 76 fi |
pascal@229 | 77 } |
pascal@229 | 78 |
pascal@229 | 79 # Pre remove commands for Tazpkg. |
pascal@229 | 80 pre_remove() |
pascal@229 | 81 { |
pascal@377 | 82 set_patch '' -R |
pascal@229 | 83 } |