File systemd-zram-service.spec of Package systemd-zram-service

# spec file for package systemd-zram-service
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2012-2018 Malcolm J Lewis <>
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           systemd-zram-service
Version:        0.2.1
Release:        0
Summary:        Systemd service for zram
License:        GPL-2.0-only
Group:          System/Daemons
Source0:        zramswap-enabler-0.2.1.tar.bz2
#Source0:       bzr branch lp:~elementary-os/elementaryos/zramswap-enabler
Source1:        zramswapon
Source2:        zramswapoff
Source3:        zramswap.service
Conflicts:      compcache
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

A successor to compcache, zRam, has been already integrated in the Linux kernel
for a while now. This means that no additional compilation nor tweaking is
required to benefit from compressing memory on the fly and massively reduced

This package contains command line scripts zramswapon, zramswapoff to enable
zRam devices as required, or at boot time via a systemd service.

Individual Compressed RAM Block Devices are created based on cores/threads
available, the size of each block device is calculated on cores/threads divided
by total ram installed. The final total is then added to system swap.

%setup -q -n zramswap-enabler-%{version}

# No building required, just a placehoder.

mkdir -p %{buildroot}%{_sbindir}
install -m 0755 %{S:1} %{S:2} %{buildroot}%{_sbindir}/
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{S:3} %{buildroot}%{_unitdir}/
pushd %{buildroot}%{_sbindir}
ln -s service rczramswap

%service_add_pre zramswap.service

%service_add_post zramswap.service

%service_del_preun zramswap.service

%service_del_postun zramswap.service

%doc debian/copyright debian/changelog

openSUSE Build Service is sponsored by