wok diff linux64-zram/stuff/compcache @ rev 14545

firefox-langpack-pt_PT: Up to 17.0.6esr
author Dominique Corbex <domcox@slitaz.org>
date Wed May 22 21:57:02 2013 +0200 (2013-05-22)
parents
children 6a53523bda6d
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linux64-zram/stuff/compcache	Wed May 22 21:57:02 2013 +0200
     1.3 @@ -0,0 +1,47 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/compcache: Start, stop and restart COMPCACHE daemon on SliTaz,
     1.6 +# at boot time or with the command line. Daemons options are configured
     1.7 +# with /etc/daemons.conf
     1.8 +#
     1.9 +. /etc/init.d/rc.functions
    1.10 +source /etc/compcache.conf
    1.11 +
    1.12 +NAME="compcache"
    1.13 +EXIST=`cat /proc/swaps | grep zram0`
    1.14 +
    1.15 +case "$1" in
    1.16 +  start)
    1.17 +    if [ ! "$EXIST" = "" ] ; then
    1.18 +      echo "$NAME already running."
    1.19 +      exit 1
    1.20 +    fi
    1.21 +    echo -n "Loading module"
    1.22 +    modprobe zram num_devices=1 &&
    1.23 +    [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize
    1.24 +    status
    1.25 +
    1.26 +    echo -n "Starting $NAME..."
    1.27 +    mkswap /dev/zram0 && swapon /dev/zram0 -p 100
    1.28 +    status
    1.29 +    ;;
    1.30 +  stop)
    1.31 +    if [ "$EXIST" = "" ] ; then
    1.32 +      echo "$NAME is not running."
    1.33 +      exit 1
    1.34 +    fi
    1.35 +    echo -n "Stopping $NAME... "
    1.36 +    swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset
    1.37 +    status
    1.38 +    echo -n "Unloding modules"
    1.39 +    rmmod zram
    1.40 +    status
    1.41 +    ;;
    1.42 +  *)
    1.43 +    echo ""
    1.44 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop]"
    1.45 +    echo ""
    1.46 +    exit 1
    1.47 +    ;;
    1.48 +esac
    1.49 +
    1.50 +exit 0