#! /bin/sh
### BEGIN INIT INFO
# Provides: zramstuff
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2
# Default-Stop: 0 6
# Short-Description: Enable swap to compressed ram
# Description: Enables swapping to compressed ram
### END INIT INFO
case "$1" in
start)
# get the number of CPUs
num_cpus=$(grep -c processor /proc/cpuinfo)
# if something goes wrong, assume we have 1
[ "$num_cpus" != 0 ] || num_cpus=1
# set decremented number of CPUs
decr_num_cpus=$((num_cpus - 1))
# get the amount of memory in the machine
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching "[[:digit:]]+")
mem_total=$((mem_total_kb * 1024))