2020-01-06 16:15:51 +00:00
|
|
|
#
|
|
|
|
# spec file for package earlyoom
|
|
|
|
#
|
2024-04-16 06:41:35 +00:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2020-01-06 16:15:51 +00:00
|
|
|
#
|
|
|
|
# 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/
|
|
|
|
#
|
|
|
|
|
2020-01-06 10:14:39 +00:00
|
|
|
|
2024-05-12 19:47:04 +00:00
|
|
|
# The tests are quite flaky in a VM
|
2020-09-17 10:52:55 +00:00
|
|
|
%bcond_with tests
|
2020-01-06 10:14:39 +00:00
|
|
|
%if ! 0%{?_fillupdir:1}
|
2020-01-06 16:15:51 +00:00
|
|
|
%global _fillupdir %{_localstatedir}/adm/fillup-templates
|
2020-01-06 10:14:39 +00:00
|
|
|
%endif
|
2020-01-06 16:15:51 +00:00
|
|
|
Name: earlyoom
|
2024-05-12 19:47:04 +00:00
|
|
|
Version: 1.8.2
|
2020-01-08 16:39:10 +00:00
|
|
|
Release: 0
|
2020-01-06 16:15:51 +00:00
|
|
|
Summary: Early OOM Daemon for Linux
|
|
|
|
License: MIT
|
2020-02-21 16:30:34 +00:00
|
|
|
Group: System/Daemons
|
2020-07-03 08:02:42 +00:00
|
|
|
URL: https://github.com/rfjakob/%{name}
|
2022-05-16 09:32:04 +00:00
|
|
|
Source0: https://github.com/rfjakob/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
|
|
|
Source1: %{name}.sysconfig
|
2024-04-16 06:41:35 +00:00
|
|
|
# pandoc MANPAGE.md -s -t man > earlyoom.1
|
2022-05-16 09:32:04 +00:00
|
|
|
Source2: earlyoom.1
|
2020-01-07 11:06:59 +00:00
|
|
|
BuildRequires: pkgconfig
|
|
|
|
BuildRequires: pkgconfig(systemd)
|
2021-01-04 15:21:15 +00:00
|
|
|
Conflicts: oomd
|
2020-09-17 10:52:55 +00:00
|
|
|
%if %{with tests}
|
|
|
|
BuildRequires: go
|
|
|
|
%endif
|
2020-01-06 10:14:39 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
earlyoom checks the amount of available memory and free swap, and if both are
|
|
|
|
below critical level, it will kill the largest process (highest oom_score).
|
|
|
|
|
|
|
|
%prep
|
2022-05-16 09:32:04 +00:00
|
|
|
%autosetup -p1
|
2020-01-06 16:15:51 +00:00
|
|
|
sed -i 's|/default/|/sysconfig/|' earlyoom.service.in
|
2020-09-17 10:52:55 +00:00
|
|
|
sed -e '/systemctl/d' -i Makefile
|
|
|
|
|
2020-01-06 10:14:39 +00:00
|
|
|
%build
|
2020-07-03 08:02:42 +00:00
|
|
|
CFLAGS='%{?build_cflags}%{!?build_cflags:%optflags} -DVERSION=\"%{version}\" -std=gnu99'
|
|
|
|
CPPFLAGS='%{?build_cxxflags}%{!?build_cxxflags:%optflags}'
|
2020-09-17 10:52:55 +00:00
|
|
|
LDFLAGS="-lrt ${RPM_LD_FLAGS}"
|
2020-07-03 08:02:42 +00:00
|
|
|
%make_build CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" PREFIX=%{_prefix}
|
2020-01-06 10:14:39 +00:00
|
|
|
|
2020-09-17 10:52:55 +00:00
|
|
|
%check
|
2024-05-12 19:47:04 +00:00
|
|
|
test %{SOURCE2} -nt README.md
|
2020-09-17 10:52:55 +00:00
|
|
|
%if %{with tests}
|
2024-05-12 19:47:04 +00:00
|
|
|
sed -i 's|stderrContains: "earlyoom v",|stderrContains: "earlyoom %{version}",|' testsuite_cli_test.go
|
2020-09-17 10:52:55 +00:00
|
|
|
%make_build test
|
|
|
|
%endif
|
|
|
|
|
2020-01-06 10:14:39 +00:00
|
|
|
%install
|
2020-01-08 16:39:10 +00:00
|
|
|
%make_install PREFIX=%{_prefix} SYSTEMDUNITDIR=%{_unitdir}
|
2022-05-16 09:32:04 +00:00
|
|
|
install -Dpm0644 %{SOURCE1} %{buildroot}%{_fillupdir}/sysconfig.%{name}
|
|
|
|
install -Dpm0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/%{name}.1
|
2020-01-06 10:14:39 +00:00
|
|
|
|
2021-01-04 15:21:15 +00:00
|
|
|
mkdir -p %{buildroot}%{_sbindir}
|
2022-05-16 09:32:04 +00:00
|
|
|
ln -s service %{buildroot}%{_sbindir}/rc%{name}
|
2021-01-04 15:21:15 +00:00
|
|
|
|
2020-01-06 10:14:39 +00:00
|
|
|
%files
|
2020-01-06 16:15:51 +00:00
|
|
|
%license LICENSE
|
|
|
|
%doc MANPAGE.md README.md
|
2020-02-21 16:23:48 +00:00
|
|
|
%{_bindir}/%{name}
|
2020-01-06 10:14:39 +00:00
|
|
|
%{_unitdir}/%{name}.service
|
2020-02-21 16:23:48 +00:00
|
|
|
%exclude %{_sysconfdir}/default/%{name}
|
2020-01-06 10:14:39 +00:00
|
|
|
%{_fillupdir}/sysconfig.%{name}
|
2021-01-04 15:21:15 +00:00
|
|
|
%{_sbindir}/rc%{name}
|
2020-02-21 16:23:48 +00:00
|
|
|
%{_mandir}/man1/%{name}.1%{?ext_man}
|
2020-01-06 10:14:39 +00:00
|
|
|
|
|
|
|
%pre
|
|
|
|
%{service_add_pre %{name}.service}
|
|
|
|
|
|
|
|
%post
|
|
|
|
%{fillup_only %{name}}
|
|
|
|
%{service_add_post %{name}.service}
|
|
|
|
|
|
|
|
%preun
|
|
|
|
%{service_del_preun %{name}.service}
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%{service_del_postun %{name}.service}
|
|
|
|
|
|
|
|
%changelog
|