diff --git a/rust-zram-generator.spec b/rust-zram-generator.spec new file mode 100644 index 0000000000000000000000000000000000000000..96e584481cc752043c8f84bdc72b263b1401b8f0 --- /dev/null +++ b/rust-zram-generator.spec @@ -0,0 +1,99 @@ +%global crate zram-generator + +Name: rust-%{crate} +Version: 1.1.2 +Release: 3 +Summary: Systemd unit generator for zram swap devices + +License: MIT +URL: https://crates.io/crates/zram-generator +Source: %{crate}-%{version}.crate +Source1: zram-generator.conf +Source2: zram-generator-vendor.tar.gz + +BuildRequires: rust-packaging rubygem-ronn + +%global _description %{expand: +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.) +} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +Recommends: %{_sbindir}/zramctl +License: MIT + +%description -n %{crate} %{_description} + +%package -n %{crate}-defaults +Summary: Default configuration for %{crate} +Requires: %{crate} = %{version}-%{release} +Obsoletes: zram < 0.4-2 +BuildArch: noarch + +%description -n %{crate}-defaults +%{summary}. + +%prep +%autosetup -n %{crate}-%{version} -p1 +cp -a %{S:1} . +tar zxvf %{SOURCE2} +%cargo_prep + +mkdir -p .cargo +cat >.cargo/config << EOF + +[source.crates-io] +replace-with = "vendored-sources" + +[source.vendored-sources] +directory = "vendor" +EOF + +%build +export SYSTEMD_UTIL_DIR=%{_systemd_util_dir} +export LC_ALL=C.UTF-8 +%cargo_build +%make_build SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \ + systemd-service man + +%install +export SYSTEMD_UTIL_DIR=%{_systemd_util_dir} +%cargo_install + +mkdir -p %{buildroot}%{?_systemdgeneratordir} +cp -a $PWD/.cargo/bin %{buildroot}/usr/ +mv -v %{buildroot}%{_bindir}/zram-generator %{buildroot}%{?_systemdgeneratordir}/ +install -Dpm0644 -t %{buildroot}%{?_unitdir} units/systemd-zram-setup@.service +install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd %{SOURCE1} +install -Dpm0644 -t %{buildroot}%{_mandir}/man8 man/zram-generator.8 +install -Dpm0644 -t %{buildroot}%{_mandir}/man5 man/zram-generator.conf.5 +rm -rf %{buildroot}%{cargo_registry}/%{crate}-%{version} + +%files -n %{crate} +%license LICENSE +%doc zram-generator.conf.example +%doc README.md +%{?_systemdgeneratordir}/zram-generator +%{?_unitdir}/systemd-zram-setup@.service +%{_mandir}/man8/zram-generator.8* +%{_mandir}/man5/zram-generator.conf.5* + +%files -n %{crate}-defaults +%{_prefix}/lib/systemd/zram-generator.conf + +%changelog +* Fri Dec 09 2022 dingdingaaaaa - 1.1.2-3 +- Enable debuginfo for fix strip + +* Thu Sep 8 2022 duyiwei - 1.1.2-2 +- remove useless subpackage zram-generator-devel + +* Tue Jul 19 2022 duyiwei - 1.1.2-1 +- upgrade to 1.1.2 + +* Tue May 10 2022 duyiwei - 0.3.2-1 +- Package init diff --git a/zram-generator-1.1.2.crate b/zram-generator-1.1.2.crate new file mode 100644 index 0000000000000000000000000000000000000000..58ca893f3ccc9f27900a4cabe63a57da5e33bbc8 Binary files /dev/null and b/zram-generator-1.1.2.crate differ diff --git a/zram-generator-vendor.tar.gz b/zram-generator-vendor.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..87c8c7e063f9087d04060a46393d430114cb7518 Binary files /dev/null and b/zram-generator-vendor.tar.gz differ diff --git a/zram-generator.conf b/zram-generator.conf new file mode 100644 index 0000000000000000000000000000000000000000..2c046320658c6fb54134934ca644dd44fa96c581 --- /dev/null +++ b/zram-generator.conf @@ -0,0 +1,8 @@ +# This config file enables a /dev/zram0 device with the default settings: +# — size — same as available RAM or 8GB, whichever is less +# — compression — most likely lzo-rle +# +# To disable, uninstall zram-generator-defaults or create empty +# /etc/systemd/zram-generator.conf file. +[zram0] +zram-size = min(ram, 8192) \ No newline at end of file