wok annotate slitaz-loram-http/receipt @ rev 1335
Add krb5
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Aug 31 11:58:29 2008 +0000 (2008-08-31) |
parents | |
children | 3f49dc9f3e80 |
rev | line source |
---|---|
pascal@1290 | 1 # SliTaz package receipt. |
pascal@1290 | 2 |
pascal@1290 | 3 PACKAGE="slitaz-loram-http" |
pascal@1290 | 4 VERSION="1.0" |
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@1290 | 9 DEPENDS="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@1290 | 22 local i |
pascal@1290 | 23 tag="Handle kernel cmdline parameter config" |
pascal@1290 | 24 i=$(grep -n "$tag" $1/etc/init.d/rcS | cut -d: -f1) |
pascal@1290 | 25 i=$(($i-1)) |
pascal@1290 | 26 tag=$(grep "$tag" $1/etc/init.d/rcS) |
pascal@1290 | 27 if [ "$2" = "-R" ]; then |
pascal@1290 | 28 line="-$(($i-50)),52 +$(($i-50)),2" |
pascal@1290 | 29 i="-" |
pascal@1290 | 30 else |
pascal@1290 | 31 grep -q 'from slitaz-loram-http package' $1/etc/init.d/rcS && return |
pascal@1290 | 32 line="-$i,2 +$i,52" |
pascal@1290 | 33 i="+" |
pascal@1290 | 34 fi |
pascal@1290 | 35 patch -p0 <<EOF |
pascal@1290 | 36 --- $1/etc/init.d/rcS |
pascal@1290 | 37 +++ $1/etc/init.d/rcS |
pascal@1290 | 38 @@ $line @@ |
pascal@1290 | 39 |
pascal@1290 | 40 $i# Try to release http link (from slitaz-loram-http package) |
pascal@1290 | 41 $i release_http() |
pascal@1290 | 42 $i { |
pascal@1290 | 43 $i FREEMEM=\$(free | awk '{ n = \$NF } END { print n }') |
pascal@1290 | 44 $i if [ \$FREEMEM -gt \$(du -s \$FS | awk '{ print \$1+40000 }') ]; then |
pascal@1290 | 45 $i status |
pascal@1290 | 46 $i echo -n "Loading /usr in memory..." |
pascal@1290 | 47 $i cp -a \$FS /.usr.fs |
pascal@1290 | 48 $i status |
pascal@1290 | 49 $i echo -n "Releasing HTTP link..." |
pascal@1290 | 50 $i umount /cdrom && umount /cdrom |
pascal@1290 | 51 $i FS=/.usr.fs |
pascal@1290 | 52 $i return 0 |
pascal@1290 | 53 $i fi |
pascal@1290 | 54 $i return 1 |
pascal@1290 | 55 $i } |
pascal@1290 | 56 $i |
pascal@1290 | 57 $i# Mount /usr (from slitaz-loram-http package) |
pascal@1290 | 58 $i if [ -d /cdrom ]; then |
pascal@1290 | 59 $i /etc/init.d/network.sh |
pascal@1290 | 60 $i RUN_SCRIPTS="\$(echo \$RUN_SCRIPTS | sed 's/network.sh//')" |
pascal@1290 | 61 $i /bin/httpfs http://mirror.slitaz.org/iso/$(cat /etc/slitaz-release)/flavors/slitaz-loram-cdrom.iso /cdrom |
pascal@1290 | 62 $i mount -o loop,ro /cdrom/*.iso /cdrom |
pascal@1290 | 63 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then |
pascal@1290 | 64 $i echo -n "Mounting /usr read-write... " |
pascal@1290 | 65 $i usr=.usr.ro |
pascal@1290 | 66 $i else |
pascal@1290 | 67 $i echo -n "Mounting /usr read-only... " |
pascal@1290 | 68 $i usr=usr |
pascal@1290 | 69 $i fi |
pascal@1290 | 70 $i FS=/cdrom/usr.cromfs |
pascal@1290 | 71 $i if [ -f \$FS ]; then |
pascal@1290 | 72 $i release_http |
pascal@1290 | 73 $i mkdir /\$usr |
pascal@1290 | 74 $i /bin/cromfs-driver \$FS /\$usr |
pascal@1290 | 75 $i elif [ -f /cdrom/usr.sqfs ]; then |
pascal@1290 | 76 $i FS=/cdrom/usr.sqfs |
pascal@1290 | 77 $i release_http |
pascal@1290 | 78 $i mkdir /\$usr |
pascal@1290 | 79 $i mount -o loop,ro -t squashfs \$FS /\$usr |
pascal@1290 | 80 $i else |
pascal@1290 | 81 $i FS=/cdrom/usr |
pascal@1290 | 82 $i ln -s \$FS /\$usr |
pascal@1290 | 83 $i fi |
pascal@1290 | 84 $i status |
pascal@1290 | 85 $i if [ -d /.usr.rw -a -x /bin/funionfs ]; then |
pascal@1290 | 86 $i /bin/funionfs -o dirs=/.usr.ro=RO:/.usr.rw -o allow_other,nonempty NONE /usr |
pascal@1290 | 87 $i fi |
pascal@1290 | 88 $i fi |
pascal@1290 | 89 $i |
pascal@1290 | 90 $tag |
pascal@1290 | 91 EOF |
pascal@1290 | 92 chmod 0755 $1/etc/init.d/rcS |
pascal@1290 | 93 } |
pascal@1290 | 94 |
pascal@1290 | 95 # Pre and post install commands for Tazpkg. |
pascal@1290 | 96 pre_install() |
pascal@1290 | 97 { |
pascal@1290 | 98 local i |
pascal@1290 | 99 for i in $(cd /var/lib/tazpkg/installed ; ls -d slitaz-loram* 2> /dev/null); do |
pascal@1290 | 100 [ "$i" = "$PACKAGE" ] && continue |
pascal@1290 | 101 yes y | tazpkg remove $i |
pascal@1290 | 102 . /etc/tazlito/tazlito.conf |
pascal@1290 | 103 rm -f $PACKAGES_REPOSITORY/slitaz-boot-scripts-*.tazpkg 2> /dev/null |
pascal@1290 | 104 done |
pascal@1290 | 105 } |
pascal@1290 | 106 |
pascal@1290 | 107 post_install() |
pascal@1290 | 108 { |
pascal@1290 | 109 set_patch "$1" |
pascal@1290 | 110 if [ ! -x $1/bin/funionfs ]; then |
pascal@1290 | 111 cat <<EOF |
pascal@1290 | 112 ---- |
pascal@1290 | 113 You will build a live CD with /usr mounted read-only. |
pascal@1290 | 114 You can install funionfs to have read-write access into /usr with: |
pascal@1290 | 115 |
pascal@1290 | 116 # tazpkg get-install funionfs |
pascal@1290 | 117 |
pascal@1290 | 118 EOF |
pascal@1290 | 119 fi |
pascal@1290 | 120 } |
pascal@1290 | 121 |
pascal@1290 | 122 # Pre remove commands for Tazpkg. |
pascal@1290 | 123 pre_remove() |
pascal@1290 | 124 { |
pascal@1290 | 125 set_patch '' -R |
pascal@1290 | 126 } |