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

xfi, xfw, cryptkeeper: (not so) dirty hack
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 16 11:41:49 2018 +0100 (2018-12-16)
parents 6a53523bda6d
children 2ba7edb00cce
line diff
     1.1 --- a/linux64-zram/stuff/compcache	Fri May 16 03:34:24 2014 +0000
     1.2 +++ b/linux64-zram/stuff/compcache	Sun Dec 16 11:41:49 2018 +0100
     1.3 @@ -7,39 +7,39 @@
     1.4  source /etc/compcache.conf
     1.5  
     1.6  NAME="compcache"
     1.7 -EXIST=`cat /proc/swaps | grep zram0`
     1.8 +DESC="$(_ '%s daemon' compcache)"
     1.9 +EXIST=$(cat /proc/swaps | grep zram0)
    1.10  
    1.11  case "$1" in
    1.12    start)
    1.13 -    if [ ! "$EXIST" = "" ] ; then
    1.14 -      echo "$NAME already running."
    1.15 +    if [ -n "$EXIST" ] ; then
    1.16 +      _ '%s is already running.' $NAME
    1.17        exit 1
    1.18      fi
    1.19 -    echo -n "Loading module"
    1.20 +    action 'Loading module...'
    1.21      modprobe zram zram_num_devices=1 &&
    1.22      [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize
    1.23      status
    1.24  
    1.25 -    echo -n "Starting $NAME..."
    1.26 +    action 'Starting %s: %s...' "$DESC" $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 +    if [ -z "$EXIST" ] ; then
    1.34 +      _ '%s is not running.' $NAME
    1.35        exit 1
    1.36      fi
    1.37 -    echo -n "Stopping $NAME... "
    1.38 +    action 'Stopping %s: %s...' "$DESC" $NAME
    1.39      swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset
    1.40      status
    1.41 -    echo -n "Unloading module"
    1.42 +    action 'Unloading module...'
    1.43      rmmod zram
    1.44      status
    1.45      ;;
    1.46    *)
    1.47 -    echo ""
    1.48 -    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop]"
    1.49 -    echo ""
    1.50 +    emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop]"
    1.51 +    newline
    1.52      exit 1
    1.53      ;;
    1.54  esac