wok-current annotate slitaz-loram/receipt @ rev 4699

Up: gdb-dev (7.0.1)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 02 11:34:40 2010 +0100 (2010-01-02)
parents d9ddcc6d973c
children fa0257184d3c
rev   line source
pascal@229 1 # SliTaz package receipt.
pascal@229 2
pascal@229 3 PACKAGE="slitaz-loram"
pascal@4099 4 VERSION="1.5"
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@1964 8 DEPENDS="slitaz-boot-scripts tazlito cromfs-or-squashfs"
pankso@422 9 WEB_SITE="http://www.slitaz.org/"
pascal@229 10
pascal@229 11 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@229 12 genpkg_rules()
pascal@229 13 {
pascal@229 14 mkdir -p $fs/etc/tazlito
pascal@370 15 cp stuff/loram.* $fs/etc/tazlito
pascal@229 16 }
pascal@229 17
pascal@377 18 set_patch()
pascal@229 19 {
pascal@370 20 local tag
pascal@370 21 local line
pascal@4099 22 local len
pascal@370 23 local i
pascal@1287 24 tag="/dev/cdrom if need"
pascal@375 25 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
pascal@370 26 i=$(($i-1))
pascal@4099 27 len=38
pascal@375 28 tag=$(grep "$tag" $1/etc/init.d/rcS)
pascal@375 29 if [ "$2" = "-R" ]; then
pascal@4099 30 line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
pascal@370 31 i="-"
pascal@370 32 else
pascal@389 33 grep -q 'from slitaz-loram package' $1/etc/init.d/rcS && return
pascal@4099 34 line="-$i,2 +$i,$len"
pascal@370 35 i="+"
pascal@370 36 fi
pascal@4186 37 busybox patch -p0 <<EOF
pascal@375 38 --- $1/etc/init.d/rcS
pascal@375 39 +++ $1/etc/init.d/rcS
pascal@370 40 @@ $line @@
pascal@229 41
pascal@389 42 $i# Mount compressed /usr (from slitaz-loram package)
pascal@4099 43 $i while [ -f /.usr.cromfs -o -f /.usr.sqfs ]; do
pascal@389 44 $i usr=usr
pascal@389 45 $i echo -n "Mounting /usr read-"
pascal@370 46 $i if [ -d /.usr.rw ]; then
pascal@389 47 $i usr=.usr.ro
pascal@389 48 $i echo -n "write... "
pascal@389 49 $i else
pascal@389 50 $i echo -n "only... "
pascal@389 51 $i fi
pascal@4454 52 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
pascal@4503 53 $i if ! grep -q " keep-loram" /proc/cmdline && [ \$FREEMEM -gt \\
pascal@4454 54 $i \$(du -s \$FS | awk '{ print (\$1*4)+40000 }') ]; then
pascal@4099 55 $i echo -n "Extracting loram..."
pascal@4099 56 $i . /etc/tazlito/loram.extract
pascal@4099 57 $i if status; then
pascal@4099 58 $i yes y | tazpkg remove slitaz-loram > /dev/null
pascal@4099 59 $i break
pascal@4099 60 $i fi
pascal@4099 61 $i fi
pascal@389 62 $i if [ -f /.usr.cromfs ]; then
pascal@1884 63 $i /bin/cromfs-driver /.usr.cromfs /\$usr -o ro,dev,suid,allow_other
pascal@389 64 $i else
pascal@389 65 $i /bin/mount -o loop,ro -t squashfs /.usr.sqfs /\$usr
pascal@389 66 $i fi
pascal@389 67 $i if [ -d /.usr.rw ]; then
pascal@1884 68 $i if [ -x bin/funionfs ]; then
pascal@1884 69 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
pascal@1884 70 $i else
pascal@1891 71 $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
pascal@1884 72 $i fi
pascal@370 73 $i fi
pascal@370 74 $i status
pascal@4099 75 $i break
pascal@4099 76 $i done
pascal@370 77 $i
pascal@370 78 $tag
pascal@229 79 EOF
pascal@375 80 chmod 0755 $1/etc/init.d/rcS
pascal@229 81 }
pascal@229 82
pascal@229 83 # Pre and post install commands for Tazpkg.
pascal@251 84 pre_install()
pascal@251 85 {
pascal@380 86 local i
pascal@380 87 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
pascal@380 88 [ "$i" = "$PACKAGE" ] && continue
pascal@380 89 yes y | tazpkg remove $i
pascal@1285 90 . /etc/tazlito/tazlito.conf
pascal@389 91 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
pascal@380 92 done
pascal@251 93 }
pascal@251 94
pascal@229 95 post_install()
pascal@229 96 {
pascal@395 97 set_patch "$1"
pascal@4503 98 cat <<EOF
pascal@4503 99 ----
pascal@4503 100 'tazlito gen-distro' will create a loram flavor while this package is installed.
pascal@4503 101 EOF
pascal@1884 102 if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs ]; then
pascal@371 103 cat <<EOF
pascal@389 104 ----
pascal@371 105 You will build a live CD with /usr mounted read-only.
pascal@1884 106 You can install aufs or funionfs to have read-write access into /usr with:
pascal@389 107
pascal@1884 108 # tazpkg get-install aufs
pascal@1884 109 or
pascal@371 110 # tazpkg get-install funionfs
pascal@389 111
pascal@371 112 EOF
pascal@371 113 fi
pascal@229 114 }
pascal@229 115
pascal@229 116 # Pre remove commands for Tazpkg.
pascal@229 117 pre_remove()
pascal@229 118 {
pascal@377 119 set_patch '' -R
pascal@4503 120 cat <<EOF
pascal@4503 121 ----
pascal@4503 122 'tazlito gen-distro' will work as expected now.
pascal@4503 123 EOF
pascal@229 124 }