#!/bin/sh

#     DESCRIPTION
#     
# Configures zram-swap to use a quarter of RAM

#     REQUIRES
#
#     Nothing

NAME="init3-zram"

verbose()
{
    if [ -n "$GLOBAL_VERBOSE" ]; then
        echo "HOOK: $NAME: $@"
    fi
}

verbose "has started"

[ -f /etc/sysconfig/zram-swap ] || exit 0

subst 's:ZSIZE=0:ZSIZE=$(($(cat /proc/meminfo | grep MemTotal | sed "s/[^0-9]*//g")*256)):' /etc/sysconfig/zram-swap
chkconfig zram-swap on

verbose "finished"
