wok annotate slitaz-loram-cdrom/receipt @ rev 2199

Remove duplicate get-*-firmware
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 09 17:12:44 2009 +0000 (2009-02-09)
parents bc8f5b69f71c
children 3174fa1fd884
rev   line source
pascal@251 1 # SliTaz package receipt.
pascal@251 2
pascal@251 3 PACKAGE="slitaz-loram-cdrom"
pascal@1339 4 VERSION="1.4"
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"
pankso@422 8 WEB_SITE="http://www.slitaz.org/"
pascal@1964 9 DEPENDS="slitaz-boot-scripts tazlito"
pascal@251 10
pascal@251 11 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@251 12 genpkg_rules()
pascal@251 13 {
pascal@251 14 mkdir -p $fs/etc/tazlito
pascal@370 15 cp stuff/loram.* $fs/etc/tazlito
pascal@251 16 }
pascal@251 17
pascal@377 18 set_patch()
pascal@251 19 {
pascal@370 20 local tag
pascal@370 21 local line
pascal@370 22 local i
pascal@370 23 tag="Handle kernel cmdline parameter config"
pascal@375 24 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
pascal@370 25 i=$(($i-1))
pascal@375 26 tag=$(grep "$tag" $1/etc/init.d/rcS)
pascal@375 27 if [ "$2" = "-R" ]; then
pascal@1884 28 line="-$(($i-53)),55 +$(($i-53)),2"
pascal@370 29 i="-"
pascal@370 30 else
pascal@390 31 grep -q 'from slitaz-loram-cdrom package' $1/etc/init.d/rcS && return
pascal@1884 32 line="-$i,2 +$i,55"
pascal@370 33 i="+"
pascal@370 34 fi
pascal@377 35 patch -p0 <<EOF
pascal@375 36 --- $1/etc/init.d/rcS
pascal@375 37 +++ $1/etc/init.d/rcS
pascal@370 38 @@ $line @@
pascal@309 39
pascal@768 40 $i# Try to release the cdrom (from slitaz-loram-cdrom package)
pascal@768 41 $i release_cdrom()
pascal@768 42 $i {
pascal@768 43 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
pascal@768 44 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
pascal@768 45 $i cp -a \$FS /.usr.fs
pascal@768 46 $i status
pascal@768 47 $i echo -n "Releasing CD-ROM..."
pascal@768 48 $i umount /cdrom
pascal@768 49 $i FS=/.usr.fs
pascal@768 50 $i return 0
pascal@768 51 $i fi
pascal@768 52 $i return 1
pascal@768 53 $i }
pascal@768 54 $i
pascal@390 55 $i# Mount /usr (from slitaz-loram-cdrom package)
pascal@370 56 $i if [ -d /cdrom ]; then
pascal@370 57 $i mount -o ro -t iso9660 /dev/cdrom /cdrom
pascal@1884 58 $i if [ -d /.usr.rw ]; then
pascal@370 59 $i echo -n "Mounting /usr read-write... "
pascal@370 60 $i usr=.usr.ro
pascal@370 61 $i else
pascal@370 62 $i echo -n "Mounting /usr read-only... "
pascal@370 63 $i usr=usr
pascal@370 64 $i fi
pascal@768 65 $i FS=/cdrom/usr.cromfs
pascal@768 66 $i if [ -f \$FS ]; then
pascal@768 67 $i release_cdrom
pascal@1339 68 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
pascal@850 69 $i elif [ -f /cdrom/usr.sqfs ]; then
pascal@850 70 $i FS=/cdrom/usr.sqfs
pascal@768 71 $i release_cdrom
pascal@768 72 $i mount -o loop,ro -t squashfs \$FS /\$usr
pascal@768 73 $i elif [ -L /\$usr ]; then
pascal@768 74 $i FS=/cdrom/usr
pascal@768 75 $i if release_cdrom; then
pascal@768 76 $i rm -f /\$usr
pascal@768 77 $i mv \$FS /usr
pascal@768 78 $i fi
pascal@768 79 $i else
pascal@370 80 $i umount /cdrom
pascal@370 81 $i false
pascal@370 82 $i fi
pascal@370 83 $i status
pascal@1884 84 $i if [ -d /.usr.rw ]; then
pascal@1884 85 $i if [ -x /bin/funionfs ]; then
pascal@1884 86 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other -o suid,dev NONE /usr
pascal@1884 87 $i else
pascal@1891 88 $i /bin/mount -t aufs -o br:/.usr.rw:/.usr.ro none /usr
pascal@1884 89 $i fi
pascal@370 90 $i fi
pascal@370 91 $i fi
pascal@370 92 $i
pascal@370 93 $tag
pascal@251 94 EOF
pascal@780 95 tag="/var/log/dmesg.log"
pascal@780 96 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
pascal@780 97 i=$(($i-1))
pascal@780 98 tag=$(grep "$tag" $1/etc/init.d/rcS)
pascal@780 99 if [ "$2" = "-R" ]; then
pascal@780 100 line="-$(($i-7)),9 +$(($i-7)),2"
pascal@780 101 i="-"
pascal@780 102 else
pascal@780 103 line="-$i,2 +$i,9"
pascal@780 104 i="+"
pascal@780 105 fi
pascal@780 106 patch -p0 <<EOF
pascal@780 107 --- $1/etc/init.d/rcS
pascal@780 108 +++ $1/etc/init.d/rcS
pascal@780 109 @@ $line @@
pascal@780 110
pascal@780 111 $i# Build ramdisk if root=/dev/cdrom (from slitaz-loram-cdrom package)
pascal@780 112 $i if [ -L /root ]; then
pascal@780 113 $i mount -t tmpfs ramdisk /tmp
pascal@780 114 $i mkdir -p /tmp/log/lighttpd /tmp/run /tmp/lock
pascal@780 115 $i chown www.www /tmp/log/lighttpd
pascal@780 116 $i fi
pascal@780 117 $i
pascal@780 118 $tag
pascal@780 119 EOF
pascal@375 120 chmod 0755 $1/etc/init.d/rcS
pascal@251 121 }
pascal@251 122
pascal@251 123 # Pre and post install commands for Tazpkg.
pascal@251 124 pre_install()
pascal@251 125 {
pascal@380 126 local i
pascal@380 127 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
pascal@380 128 [ "$i" = "$PACKAGE" ] && continue
pascal@380 129 yes y | tazpkg remove $i
pascal@1285 130 . /etc/tazlito/tazlito.conf
pascal@390 131 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
pascal@380 132 done
pascal@251 133 }
pascal@251 134
pascal@251 135 post_install()
pascal@251 136 {
pascal@380 137 set_patch "$1"
pascal@1884 138 if [ ! -x $1/bin/funionfs -a ! -d $1/var/lib/tazpkg/installed/aufs ]; then
pascal@371 139 cat <<EOF
pascal@390 140 ----
pascal@371 141 You will build a live CD with /usr mounted read-only.
pascal@1884 142 You can install aufs or funionfs to have read-write access into /usr with:
pascal@390 143
pascal@1884 144 # tazpkg get-install aufs
pascal@1884 145 or
pascal@371 146 # tazpkg get-install funionfs
pascal@390 147
pascal@371 148 EOF
pascal@371 149 fi
pascal@251 150 }
pascal@251 151
pascal@251 152 # Pre remove commands for Tazpkg.
pascal@251 153 pre_remove()
pascal@251 154 {
pascal@377 155 set_patch '' -R
pascal@251 156 }