wok-current annotate slitaz-loram/receipt @ rev 389
Slitaz-loram: support both cromfs and squashfs
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 09 12:58:23 2008 +0000 (2008-03-09) |
parents | c9546c686c60 |
children | c4e6b92f665f |
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@389 | 27 line="-$(($i-21)),23 +$(($i-21)),2" |
pascal@370 | 28 i="-" |
pascal@370 | 29 else |
pascal@389 | 30 grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return |
pascal@389 | 31 line="-$i,2 +$i,23" |
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@389 | 39 $i# Mount compressed /usr (from slitaz-loram package) |
pascal@389 | 40 $i if [ -f /.usr.cromfs -o -f /.usr.sqfs ]; then |
pascal@389 | 41 $i usr=usr |
pascal@389 | 42 $i echo -n "Mounting /usr read-" |
pascal@370 | 43 $i if [ -d /.usr.rw ]; then |
pascal@389 | 44 $i usr=.usr.ro |
pascal@389 | 45 $i echo -n "write... " |
pascal@389 | 46 $i else |
pascal@389 | 47 $i echo -n "only... " |
pascal@389 | 48 $i fi |
pascal@389 | 49 $i if [ -f /.usr.cromfs ]; then |
pascal@389 | 50 $i /bin/cromfs-driver /.usr.cromfs /\$usr |
pascal@389 | 51 $i else |
pascal@389 | 52 $i /bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr |
pascal@389 | 53 $i fi |
pascal@389 | 54 $i if [ -d /.usr.rw ]; then |
pascal@370 | 55 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr |
pascal@370 | 56 $i fi |
pascal@370 | 57 $i status |
pascal@370 | 58 $i fi |
pascal@370 | 59 $i |
pascal@370 | 60 $tag |
pascal@229 | 61 EOF |
pascal@375 | 62 chmod 0755 $1/etc/init.d/rcS |
pascal@229 | 63 } |
pascal@229 | 64 |
pascal@229 | 65 # Pre and post install commands for Tazpkg. |
pascal@251 | 66 pre_install() |
pascal@251 | 67 { |
pascal@380 | 68 local i |
pascal@389 | 69 . /etc/tazlito/tazlito.conf |
pascal@380 | 70 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do |
pascal@380 | 71 [ "$i" = "$PACKAGE" ] && continue |
pascal@380 | 72 yes y | tazpkg remove $i |
pascal@389 | 73 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null |
pascal@380 | 74 done |
pascal@251 | 75 } |
pascal@251 | 76 |
pascal@229 | 77 post_install() |
pascal@229 | 78 { |
pascal@389 | 79 local root |
pascal@389 | 80 root=$1 |
pascal@389 | 81 set_patch "$root" |
pascal@371 | 82 if [ ! -x /bin/funionfs ]; then |
pascal@371 | 83 cat <<EOF |
pascal@389 | 84 ---- |
pascal@371 | 85 You will build a live CD with /usr mounted read-only. |
pascal@389 | 86 You can install funionfs to have read-write access into /usr with: |
pascal@389 | 87 |
pascal@371 | 88 # tazpkg get-install funionfs |
pascal@389 | 89 |
pascal@371 | 90 EOF |
pascal@371 | 91 fi |
pascal@229 | 92 } |
pascal@229 | 93 |
pascal@229 | 94 # Pre remove commands for Tazpkg. |
pascal@229 | 95 pre_remove() |
pascal@229 | 96 { |
pascal@377 | 97 set_patch '' -R |
pascal@229 | 98 } |