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