wok-current rev 1975

Add compcache
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 03 12:12:15 2009 +0000 (2009-01-03)
parents 8da74c3a8369
children 0c9917d26b5d
files compcache/receipt compcache/stuff/compcache compcache/stuff/compcache.conf
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/compcache/receipt	Sat Jan 03 12:12:15 2009 +0000
     1.3 @@ -0,0 +1,57 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="compcache"
     1.7 +VERSION="0.4"
     1.8 +CATEGORY="system-tools"
     1.9 +SHORT_DESC="Compressed caching"
    1.10 +MAINTAINER="fabrice.thiroux@free.fr"
    1.11 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.12 +WEB_SITE="http://code.google.com/p/compcache/"
    1.13 +WGET_URL="http://compcache.googlecode.com/files/$TARBALL"
    1.14 +BUILD_DEPENDS="lzma"
    1.15 +
    1.16 +# Rules to configure and make the package.
    1.17 +compile_rules()
    1.18 +{
    1.19 +    
    1.20 +    KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g`
    1.21 +    if [ ! -d $WOK/linux/linux-$KERNEL_VERSION ]; then
    1.22 +        tazwok cook linux
    1.23 +    fi
    1.24 +    cd $src
    1.25 +	find -name Makefile | xargs sed -i \
    1.26 +		"s|/lib/modules/\$(shell uname -r)/build|$WOK/linux/linux-$KERNEL_VERSION|"
    1.27 +    make  KBUILD=$WOK/linux/linux-$KERNEL_VERSION KVER=$KERNEL_VERSION 
    1.28 +}
    1.29 +
    1.30 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.31 +genpkg_rules()
    1.32 +{
    1.33 +    KERNEL_VERSION=`grep  ^VERSION= $WOK/linux/receipt | cut -d "=" -f2 | sed -e 's/"//g`
    1.34 +    EXTRAVERSION=_$KERNEL_VERSION
    1.35 +    
    1.36 +    mkdir -p $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc $fs/etc/init.d
    1.37 +    
    1.38 +    install -o root -m 755 $src/compcache.ko $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc
    1.39 +    install -o root -m 755 $src/sub-projects/allocators/tlsf-kmod/tlsf.ko $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc
    1.40 +    install -o root -m 755 $src/sub-projects/compression/lzo-kmod/lzo1x_compress.ko $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc
    1.41 +    install -o root -m 755 $src/sub-projects/compression/lzo-kmod/lzo1x_decompress.ko $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc
    1.42 +
    1.43 +	for i in $fs/lib/modules/$KERNEL_VERSION-slitaz/kernel/misc/*.ko ; do
    1.44 +		lzma e $i $i.gz && rm -f $i
    1.45 +    done
    1.46 +    install -o root -m 755 ./stuff/compcache $fs/etc/init.d/
    1.47 +    install -o root -m 755 ./stuff/compcache.conf $fs/etc/
    1.48 +}
    1.49 +
    1.50 +post_install()
    1.51 +{
    1.52 +    echo "Processing post-install commands..."
    1.53 +    depmod -a -b "$1/" ${EXTRAVERSION#_}-slitaz
    1.54 +}
    1.55 +
    1.56 +post_remove()
    1.57 +{
    1.58 +    echo "Processing post-remove commands..."
    1.59 +    depmod -a
    1.60 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/compcache/stuff/compcache	Sat Jan 03 12:12:15 2009 +0000
     2.3 @@ -0,0 +1,45 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/compcache: Start, stop and restart COMPCACHE daemon on SliTaz,
     2.6 +# at boot time or with the command line. Daemons options are configured
     2.7 +# with /etc/daemons.conf
     2.8 +#
     2.9 +. /etc/init.d/rc.functions
    2.10 +. /etc/compcache.conf
    2.11 +
    2.12 +NAME=COMPCACHE
    2.13 +EXIST=`cat /proc/swaps | grep ramzswap0`
    2.14 +
    2.15 +case "$1" in
    2.16 +  start)
    2.17 +    if [ ! "$EXIST" = "" ] ; then
    2.18 +      echo "$NAME already running."
    2.19 +      exit 1
    2.20 +    fi
    2.21 +    echo -n "Loading module"
    2.22 +    modprobe compcache # compcache_size_kbytes=$SIZE_KB
    2.23 +    status
    2.24 +    echo -n "Starting $NAME..."
    2.25 +    swapon /dev/ramzswap0 -p 100
    2.26 +    status
    2.27 +    ;;
    2.28 +  stop)
    2.29 +    if [ "$EXIST" = "" ] ; then
    2.30 +      echo "$NAME is not running."
    2.31 +      exit 1
    2.32 +    fi
    2.33 +    echo -n "Stopping $NAME... "
    2.34 +    swapoff /dev/ramzswap0    
    2.35 +    status
    2.36 +    echo -n "Unloding modules"
    2.37 +    rmmod compcache lzo1x_compress lzo1x_decompress tlsf
    2.38 +    status
    2.39 +    ;;
    2.40 +  *)
    2.41 +    echo ""
    2.42 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop]"
    2.43 +    echo ""
    2.44 +    exit 1
    2.45 +    ;;
    2.46 +esac
    2.47 +
    2.48 +exit 0
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/compcache/stuff/compcache.conf	Sat Jan 03 12:12:15 2009 +0000
     3.3 @@ -0,0 +1,1 @@
     3.4 +SIZE_KB=0