This is a simple script compatible to set up zram, it is an alternative to zram-tools and zramswap
This script depends on a posix shell interpreter, and core utilities, can operate with just busybox if need be.
Looked at other services and scripts for using zram and they were a mess to be honest, some did too much others too little, this won't be the be all end all of zram scripts and setups but so long as it serves most cases i am satisfied.
Install everything:
sudo make install-all
this will provide:
component | default location | description |
---|---|---|
zrs | /usr/local/sbin/zrs |
script that does the actual work of config parsing and zram setting |
zram | /etc/init.d/zram |
sysvinit initscript |
zram.service | /etc/systemd/system/zram.service |
systemd unit |
Edit the config.mk file to tweak installation options.
This repo provides 2 sysvinit init scripts, a hand written one and one that uses Debian's init-d-script framework that provides a Debian and LSB compliant init.d script that may be preferred on some environments, you can choose with the config.mk file.
The makefile should put the script in /etc/init.d/zram
by default, after that
a simple sudo update-rc.d zram defaults
should be enough to activate
it for the next boot
The service script supports the start, stop, restart and status actions along the init, end, stat and force-restart aliases.
A simple sudo service zram start
will initiate the zram service.
The makefile should put the unit in /etc/systemd/system/zram.service
by
default, all you need is run sudo systemctl enable zram
to activate the
service for the next boot.
Initiate the service with sudo systemctl start zram
- add debian packaging "paperwork"
- perhaps add an action in the makefile to create a .deb