diff --git a/assets/zswap-cli.conf b/rpm/zswap-cli.conf similarity index 100% rename from assets/zswap-cli.conf rename to rpm/zswap-cli.conf diff --git a/rpm/zswap-cli.service b/rpm/zswap-cli.service new file mode 100644 index 0000000..1f1a5b7 --- /dev/null +++ b/rpm/zswap-cli.service @@ -0,0 +1,12 @@ +[Unit] +Description=ZSwap-cli service +Documentation=man:zswap-cli(1) https://github.com/ElXreno/zswap-cli + +[Service] +Type=oneshot +ExecStart=/usr/bin/zswap-cli set --use-config +ProtectSystem=strict +ProtectHome=true + +[Install] +WantedBy=multi-user.target diff --git a/rpm/zswap-cli.spec b/rpm/zswap-cli.spec new file mode 100644 index 0000000..24b7cdd --- /dev/null +++ b/rpm/zswap-cli.spec @@ -0,0 +1,59 @@ +%global debug_package %{nil} + +%global commit 9419b2f2f3e6c79de581d2b7dc5df83eed4de4b6 + +Name: zswap-cli +Version: 0.1.0 +Release: 1%{?dist} +Summary: Utility for controlling zswap parameters + +License: ASL 2.0 +URL: https://github.com/ElXreno/zswap-cli +Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz +Source1: %{name}.conf +Source2: %{name}.service + +BuildRequires: cargo +BuildRequires: systemd + +%description +Utility for controlling zswap parameters + + +%prep +%autosetup -n %{name}-%{commit} + + +%build +cargo build --release + + +%install +install -m 0755 -Dp target/release/%{name} %{buildroot}%{_bindir}/%{name} +install -m 0644 -Dp %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service +install -m 0644 -Dp %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.conf + + +%post +%systemd_post %{name}.service + + +%preun +%systemd_preun %{name}.service + + +%postun +%systemd_postun_with_restart %{name}.service + + +%files +%license LICENSE +%doc README.md +%{_bindir}/%{name} +%{_unitdir}/%{name}.service +%config(noreplace) %{_sysconfdir}/%{name}.conf + + +%changelog +* Sun Apr 5 2020 ElXreno +- Initial packaging