File zramswap.spec of Package zramswap

#
# spec file for package zramswap
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           zramswap
Version:        1.0
Release:        0
Summary:        Set up zram-based swap devices on boot
License:        MIT
Group:          System/Base
Url:            https://en.wikipedia.org/wiki/Zram
Source1:        zramctrl
Source2:        %{name}.service
BuildRequires:  systemd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%systemd_requires

%description
This package contains a systemd service for setup swap devices on boot.

%prep

%build

%install
install -Dm 755 %{S:1} %{buildroot}%{_unitdir}/../scripts/zramctrl
install -Dm 644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service
install -dm 755 %{buildroot}%{_sbindir}
ln -sf service %{buildroot}%{_sbindir}/rc%{name}

%pre
%service_add_pre %{name}.service

%post
%service_add_post %{name}.service
echo "To activate the service, run as root"
echo "# systemctl enable zramswap"

%preun
%service_del_preun %{name}.service

%postun
%service_del_postun %{name}.service

%files
%defattr(-,root,root,-)
%{_sbindir}/rc%{name}
%{_unitdir}/%{name}.service
%dir %{_unitdir}/../scripts
%{_unitdir}/../scripts/zramctrl

%changelog
openSUSE Build Service is sponsored by