File zram.spec of Package zram

#
# spec file for package zram
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           zram
Version:        1.0
Release:        0
Summary:        Compressed RAM based swap device
License:        GPL-2.0-only
Group:          System/Kernel
URL:            https://www.kernel.org/doc/Documentation/blockdev/zram.txt
Source0:        sysconfig.zram
Source1:        zram-swap.service
Source2:        zramstart
Source3:        zramstop
BuildRequires:  systemd-rpm-macros
Requires:       gawk
Requires:       util-linux
Requires(post): %fillup_prereq
BuildArch:      noarch
%{?systemd_requires}

%description
ZRAM is a Linux block device that can be used for compressed swap in memory.
It's useful in memory constrained devices. This provides a service to setup
ZRAM as a swap device based on criteria such as available memory.

%prep

%build

%install
mkdir -p %{buildroot}%{_fillupdir}
install -pm 0644 %{SOURCE0} %{buildroot}%{_fillupdir}

install -d %{buildroot}%{_unitdir}/
install -pm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/

install -d %{buildroot}%{_sbindir}
install -pm 0755 %{SOURCE2} %{buildroot}%{_sbindir}
install -pm 0755 %{SOURCE3} %{buildroot}%{_sbindir}

%post
%fillup_only
%service_add_post %{name}-swap.service

%pre
%service_add_pre %{name}-swap.service

%preun
%service_del_preun %{name}-swap.service

%postun
%service_del_postun %{name}-swap.service

%files
%{_sbindir}/%{name}*
%{_fillupdir}/sysconfig.%{name}
%{_unitdir}/%{name}*

%changelog
openSUSE Build Service is sponsored by