Merge remote-tracking branch 'origin/master' into f32

Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Raits 2020-06-18 12:05:44 +02:00
commit 51e59b1bb2
No known key found for this signature in database
GPG Key ID: 115D5AB89C5C1E1E
2 changed files with 32 additions and 7 deletions

View File

@ -9,23 +9,26 @@
Name: rust-%{crate}
Version: 0.2.0~beta.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Systemd unit generator for zram swap devices
# Upstream license specification: MIT
License: MIT
URL: https://crates.io/crates/zram-generator
Source: %{crates_source}
Source1: zram-generator.conf
ExclusiveArch: %{rust_arches}
BuildRequires: rust-packaging
BuildRequires: systemd-rpm-macros
%global _description %{expand:
This is a systemd unit generator that creates a unit file to create a
zram device. To activate, copy
/usr/share/doc/zram-generator/zram-generator.conf.example to
/etc/systemd/zram-generator.conf and possibly edit to adjust the limits.}
This is a systemd unit generator that enables swap on zram.
(With zram, there is no physical swap device. Part of the avaialable RAM
is used to store compressed pages, essentially trading CPU cycles for memory.)
To activate, install %{crate}-defaults subpackage.}
%description %{_description}
@ -34,7 +37,8 @@ Summary: %{summary}
# MIT
# MIT or ASL 2.0
License: MIT
Recommends: /usr/bin/systemd-detect-virt
# for zramctl
Recommends: util-linux
%description -n %{crate} %{_description}
@ -45,13 +49,23 @@ Recommends: /usr/bin/systemd-detect-virt
%{_systemdgeneratordir}/zram-generator
%{_unitdir}/swap-create@.service
%package -n %{crate}-defaults
Summary: Default configuration for %{crate}
BuildArch: noarch
%description -n %{crate}-defaults
%{summary}.
%files -n %{crate}-defaults
%{_prefix}/lib/systemd/zram-generator.conf
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
cp -a %{S:1} .
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
echo 'systemd-rpm-macros'
%build
%cargo_build
@ -62,6 +76,7 @@ echo 'systemd-rpm-macros'
mkdir -p %{buildroot}%{_systemdgeneratordir}
mv -v %{buildroot}%{_bindir}/zram-generator %{buildroot}%{_systemdgeneratordir}/
install -Dpm0644 -t %{buildroot}%{_unitdir} units/swap-create@.service
install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd zram-generator.conf
%if %{with check}
%check
@ -69,6 +84,9 @@ install -Dpm0644 -t %{buildroot}%{_unitdir} units/swap-create@.service
%endif
%changelog
* Thu Jun 18 11:30:43 CEST 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.2.0~beta.1-3
- Create a subpackage with default configuration
* Thu Jun 18 10:14:43 CEST 2020 Igor Raits <ignatenkobrain@fedoraproject.org> - 0.2.0~beta.1-2
- Install swap-create unit file

7
zram-generator.conf Normal file
View File

@ -0,0 +1,7 @@
# This config file enables a /dev/zram0 device with the default settings:
# — size — half of available RAM or 4GB, whichever is less
# — compression — most likely lzo-rle
#
# To disable, uninstall rust-zram-defaults or create empty
# /etc/systemd/zram-generator.conf file.
[zram0]