wok-4.x annotate slitaz-loram-cdrom/receipt @ rev 371

slitaz-loram*: add post-install message
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 08 11:57:03 2008 +0000 (2008-03-08)
parents fc9f573e8ac8
children 526c779c9331
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@251 16 get_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@370 22 i=$(grep -n "$tag" /etc/init.d/rcS | cut -d: -f1)
pascal@370 23 i=$(($i-1))
pascal@370 24 tag=$(grep "$tag" /etc/init.d/rcS)
pascal@370 25 if [ "$1" = "-R" ]; then
pascal@370 26 line="-$(($i-24)),26 +$(($i-24)),2"
pascal@370 27 i="-"
pascal@370 28 else
pascal@370 29 line="-$i,2 +$i,26"
pascal@370 30 i="+"
pascal@370 31 fi
pascal@251 32 cat <<EOF
pascal@251 33 --- /etc/init.d/rcS
pascal@251 34 +++ /etc/init.d/rcS
pascal@370 35 @@ $line @@
pascal@309 36
pascal@370 37 $i# Mount /usr
pascal@370 38 $i if [ -d /cdrom ]; then
pascal@370 39 $i mount -o ro -t iso9660 /dev/cdrom /cdrom
pascal@370 40 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@370 41 $i echo -n "Mounting /usr read-write... "
pascal@370 42 $i usr=.usr.ro
pascal@370 43 $i else
pascal@370 44 $i echo -n "Mounting /usr read-only... "
pascal@370 45 $i usr=usr
pascal@370 46 $i fi
pascal@370 47 $i if [ -f /cdrom/usr.cromfs ]; then
pascal@370 48 $i /bin/cromfs-driver /cdrom/usr.cromfs /\$usr
pascal@370 49 $i elif [ -f /cdrom/usr.sqfs ]; then
pascal@370 50 $i mount -o loop,ro -t squashfs /cdrom/usr.sqfs /\$usr
pascal@370 51 $i elif [ ! -L /\$usr ]; then
pascal@370 52 $i umount /cdrom
pascal@370 53 $i false
pascal@370 54 $i fi
pascal@370 55 $i status
pascal@370 56 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@370 57 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other NONE /usr
pascal@370 58 $i fi
pascal@370 59 $i fi
pascal@370 60 $i
pascal@370 61 $tag
pascal@251 62 EOF
pascal@251 63 }
pascal@251 64
pascal@251 65 # Pre and post install commands for Tazpkg.
pascal@251 66 pre_install()
pascal@251 67 {
pascal@251 68 local $loram
pascal@251 69 loram=$(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null)
pascal@251 70 [ -n "$loram" ] && yes y | tazpkg remove $loram
pascal@251 71 }
pascal@251 72
pascal@251 73 post_install()
pascal@251 74 {
pascal@251 75 get_patch | patch -p0
pascal@371 76 if [ ! -x /bin/funionfs ]; then
pascal@371 77 cat <<EOF
pascal@371 78 You will build a live CD with /usr mounted read-only.
pascal@371 79 You can install funionfs to have read-write acces du /usr with:
pascal@371 80 # tazpkg get-install funionfs
pascal@371 81 EOF
pascal@371 82 fi
pascal@251 83 }
pascal@251 84
pascal@251 85 # Pre remove commands for Tazpkg.
pascal@251 86 pre_remove()
pascal@251 87 {
pascal@370 88 get_patch -R | patch -p0
pascal@251 89 }