wok-current annotate 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 |
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@390 | 29 grep -q 'from slitaz-loram-cdrom package' $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@390 | 38 $i# Mount /usr (from slitaz-loram-cdrom package) |
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@380 | 70 local i |
pascal@390 | 71 . /etc/tazlito/tazlito.conf |
pascal@380 | 72 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do |
pascal@380 | 73 [ "$i" = "$PACKAGE" ] && continue |
pascal@380 | 74 yes y | tazpkg remove $i |
pascal@390 | 75 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null |
pascal@380 | 76 done |
pascal@251 | 77 } |
pascal@251 | 78 |
pascal@251 | 79 post_install() |
pascal@251 | 80 { |
pascal@380 | 81 set_patch "$1" |
pascal@371 | 82 if [ ! -x /bin/funionfs ]; then |
pascal@371 | 83 cat <<EOF |
pascal@390 | 84 ---- |
pascal@371 | 85 You will build a live CD with /usr mounted read-only. |
pascal@390 | 86 You can install funionfs to have read-write access into /usr with: |
pascal@390 | 87 |
pascal@371 | 88 # tazpkg get-install funionfs |
pascal@390 | 89 |
pascal@371 | 90 EOF |
pascal@371 | 91 fi |
pascal@251 | 92 } |
pascal@251 | 93 |
pascal@251 | 94 # Pre remove commands for Tazpkg. |
pascal@251 | 95 pre_remove() |
pascal@251 | 96 { |
pascal@377 | 97 set_patch '' -R |
pascal@251 | 98 } |