wok annotate slitaz-loram-http/receipt @ rev 6984

Added docbook-xsl.
author Christopher Rogers <slaxemulator@gmail.com>
date Fri Oct 29 01:23:27 2010 +0000 (2010-10-29)
parents fa0257184d3c
children a40a0eb643ba
rev   line source
pascal@1290 1 # SliTaz package receipt.
pascal@1290 2
pascal@1290 3 PACKAGE="slitaz-loram-http"
pascal@5535 4 VERSION="1.6"
pascal@1290 5 CATEGORY="misc"
pascal@1290 6 SHORT_DESC="Rules to build low ram system using http."
pascal@1290 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@1290 8 WEB_SITE="http://www.slitaz.org/"
pascal@1964 9 DEPENDS="slitaz-boot-scripts tazlito httpfs-fuse funionfs"
pascal@1290 10
pascal@1290 11 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1290 12 genpkg_rules()
pascal@1290 13 {
pascal@1290 14 mkdir -p $fs/etc/tazlito
pascal@1290 15 cp stuff/loram.* $fs/etc/tazlito
pascal@1290 16 }
pascal@1290 17
pascal@1290 18 set_patch()
pascal@1290 19 {
pascal@1290 20 local tag
pascal@1290 21 local line
pascal@4099 22 local len
pascal@1290 23 local i
pascal@1290 24 tag="Handle kernel cmdline parameter config"
pascal@1290 25 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1)
pascal@1290 26 i=$(($i-1))
pascal@5535 27 len=89
pascal@1290 28 tag=$(grep "$tag" $1/etc/init.d/rcS)
pascal@1290 29 if [ "$2" = "-R" ]; then
pascal@4099 30 line="-$(($i-$len+2)),$len +$(($i-$len+2)),2"
pascal@1290 31 i="-"
pascal@1290 32 else
pascal@1290 33 grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return
pascal@4099 34 line="-$i,2 +$i,$len"
pascal@1290 35 i="+"
pascal@1290 36 fi
pascal@4186 37 busybox patch -p0 <<EOF
pascal@1290 38 --- $1/etc/init.d/rcS
pascal@1290 39 +++ $1/etc/init.d/rcS
pascal@1290 40 @@ $line @@
pascal@1290 41
pascal@1290 42 $i# Try to release http link (from slitaz-loram-http package)
pascal@1290 43 $i release_http()
pascal@1290 44 $i {
pascal@4454 45 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }')
pascal@4454 46 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then
pascal@1290 47 $i status
pascal@4503 48 $i if ! grep -q " keep-loram" /proc/cmdline &&
pascal@4454 49 $i [ -d \$FS -o \$FREEMEM -gt \$(du -s \$FS | \\
pascal@4454 50 $i awk '{ print (\$1*4)+40000 }') ]; then
pascal@4099 51 $i echo -n "Extracting loram..."
pascal@4099 52 $i . /etc/tazlito/loram.extract /cdrom
pascal@4099 53 $i if status; then
pascal@4099 54 $i umount /cdrom && umount /cdrom
pascal@4099 55 $i rmdir /cdrom
pascal@4099 56 $i yes y | tazpkg remove slitaz-loram-http > /dev/null
pascal@4099 57 $i return 0
pascal@4099 58 $i fi
pascal@4099 59 $i fi
pascal@1290 60 $i echo -n "Loading /usr in memory..."
pascal@1290 61 $i cp -a \$FS /.usr.fs
pascal@1290 62 $i status
pascal@1290 63 $i echo -n "Releasing HTTP link..."
pascal@1290 64 $i umount /cdrom && umount /cdrom
pascal@1290 65 $i FS=/.usr.fs
pascal@4099 66 $i if [ -d \$FS ]; then
pascal@4099 67 $i rm -f /\$usr
pascal@4099 68 $i mv \$FS /usr
pascal@4099 69 $i fi
pascal@1290 70 $i fi
pascal@1290 71 $i return 1
pascal@1290 72 $i }
pascal@1290 73 $i
pascal@1290 74 $i# Mount /usr (from slitaz-loram-http package)
pascal@4099 75 $i while [ -d /cdrom ]; do
pascal@1290 76 $i /etc/init.d/network.sh
pascal@1290 77 $i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')"
pascal@5535 78 $i release=\$(cat /etc/slitaz-release)
pascal@5535 79 $i iso1=iso/\$release/flavors/slitaz-\$release-loram-cdrom.iso
pascal@5535 80 $i iso2=iso/\$release/flavors/slitaz-loram-cdrom.iso
pascal@5535 81 $i URLISO=http://mirror.slitaz.org/\$iso1,http://mirror.slitaz.org/\$iso2,http://download.tuxfamily.org/slitaz/\$iso1,http://download.tuxfamily.org/slitaz/\$iso2,http://slitaz.c3sl.ufpr.br/\$iso1,http://slitaz.c3sl.ufpr.br/\$iso2
pascal@4397 82 $i grep -q " urliso=" /proc/cmdline && URLISO=\$(cat /proc/cmdline | sed 's/.* urliso=\([^ ]*\).*/\1/'),\$URLISO
pascal@4397 83 $i for i in \$(echo \$URLISO | sed 's/,/ /g'); do
pascal@4728 84 $i /bin/httpfs \$i /cdrom && break
pascal@4397 85 $i done
pascal@1290 86 $i mount -o loop,ro /cdrom/*.iso /cdrom
pascal@1290 87 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@1290 88 $i echo -n "Mounting /usr read-write... "
pascal@1290 89 $i usr=.usr.ro
pascal@1290 90 $i else
pascal@1290 91 $i echo -n "Mounting /usr read-only... "
pascal@1290 92 $i usr=usr
pascal@1290 93 $i fi
pascal@1290 94 $i FS=/cdrom/usr.cromfs
pascal@1290 95 $i if [ -f \$FS ]; then
pascal@1290 96 $i mkdir /\$usr
pascal@5535 97 $i ln -s /usr/.moved /.moved
pascal@4099 98 $i release_http && break
pascal@1339 99 $i /bin/cromfs-driver \$FS /\$usr -o ro,dev,suid,allow_other
pascal@5535 100 $i elif grep -q squashfs /etc/filesystems && [ -f /cdrom/usr.sqfs ]; then
pascal@1290 101 $i FS=/cdrom/usr.sqfs
pascal@5535 102 $i ln -s /usr/.moved /.moved
pascal@1290 103 $i mkdir /\$usr
pascal@4099 104 $i release_http && break
pascal@1290 105 $i mount -o loop,ro -t squashfs \$FS /\$usr
pascal@5535 106 $i elif grep -q squashfs /etc/filesystems && [ -f /cdrom/rootfs.gz ]; then
pascal@5535 107 $i FS=/cdrom/rootfs.gz
pascal@5535 108 $i ln -s /.rootfs /.moved
pascal@5535 109 $i mkdir /.rootfs
pascal@5535 110 $i release_http && break
pascal@5535 111 $i mount -o loop,ro -t squashfs \$FS /.rootfs
pascal@5535 112 $i ln -s /.rootfs/usr /\$usr
pascal@5535 113 $i elif [ -d /cdrom/usr ]; then
pascal@5535 114 $i FS=/cdrom/usr
pascal@5535 115 $i ln -s /usr/.moved /.moved
pascal@5535 116 $i rm -rf /\$usr && ln -s \$FS /\$usr
pascal@1290 117 $i else
pascal@5535 118 $i FS=/cdrom/fs/usr
pascal@5535 119 $i ln -s /cdrom/fs /.moved
pascal@5535 120 $i rm -rf /\$usr && ln -s \$FS /\$usr
pascal@1290 121 $i fi
pascal@1290 122 $i status
pascal@1290 123 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then
pascal@1339 124 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty -o suid,dev NONE /usr
pascal@1290 125 $i fi
pascal@4099 126 $i break
pascal@4099 127 $i done
pascal@1290 128 $i
pascal@1290 129 $tag
pascal@1290 130 EOF
pascal@1290 131 chmod 0755 $1/etc/init.d/rcS
pascal@1290 132 }
pascal@1290 133
pascal@1290 134 # Pre and post install commands for Tazpkg.
pascal@1290 135 pre_install()
pascal@1290 136 {
pascal@1290 137 local i
pascal@1290 138 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do
pascal@1290 139 [ "$i" = "$PACKAGE" ] && continue
pascal@1290 140 yes y | tazpkg remove $i
pascal@1290 141 . /etc/tazlito/tazlito.conf
pascal@1290 142 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null
pascal@1290 143 done
pascal@1290 144 }
pascal@1290 145
pascal@1290 146 post_install()
pascal@1290 147 {
pascal@1290 148 set_patch "$1"
pascal@5048 149
pascal@5048 150 # Don't support FAST_BOOT_X yet
pascal@5048 151 sed -i 's/FAST_BOOT_X=.*/FAST_BOOT_X="no"/' $1/etc/rcS.conf
pascal@5048 152
pascal@4503 153 cat <<EOF
pascal@4503 154 ----
pascal@4503 155 'tazlito gen-distro' will create a loram-http flavor
pascal@4503 156 while this package is installed.
pascal@4503 157 EOF
pascal@1290 158 if [ ! -x $1/bin/funionfs ]; then
pascal@1290 159 cat <<EOF
pascal@1290 160 ----
pascal@1290 161 You will build a live CD with /usr mounted read-only.
pascal@1290 162 You can install funionfs to have read-write access into /usr with:
pascal@1290 163
pascal@1290 164 # tazpkg get-install funionfs
pascal@1290 165
pascal@1290 166 EOF
pascal@1290 167 fi
pascal@1290 168 }
pascal@1290 169
pascal@1290 170 # Pre remove commands for Tazpkg.
pascal@1290 171 pre_remove()
pascal@1290 172 {
pascal@1290 173 set_patch '' -R
pascal@4503 174 cat <<EOF
pascal@4503 175 ----
pascal@4503 176 'tazlito gen-distro' will work as expected now.
pascal@4503 177 EOF
pascal@1290 178 }