diff --git a/_service b/_service deleted file mode 100644 index 8b73b3b..0000000 --- a/_service +++ /dev/null @@ -1,18 +0,0 @@ - - - - git - https://github.com/rfjakob/earlyoom - refs/tags/v1.3 - @PARENT_TAG@ - ^\D*([\d.]+)$ - - - - bz2 - *.tar - - - - - diff --git a/_service:set_version:earlyoom.spec b/_service:set_version:earlyoom.spec deleted file mode 100644 index d1062d3..0000000 --- a/_service:set_version:earlyoom.spec +++ /dev/null @@ -1,150 +0,0 @@ -%define realname earlyoom -%define srcext tar.bz2 - -%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7 -%bcond_without systemd -%else -%bcond_with systemd -%endif - -%if 0%{?rhel} && 0%{?rhel} == 6 -%bcond_without upstart -%else -%bcond_with upstart -%endif - -%if ! 0%{?_fillupdir:1} -%global _fillupdir /var/adm/fillup-templates -%endif - -%global rpm_version %(rpm -q --qf %%{version} rpm) - -# Common info -Name: %{realname} -Version: 1.3 -Release: 0%{?extraver:0.}1%{?dist} -License: MIT -Group: System/Daemons -URL: https://github.com/rfjakob/earlyoom -Summary: Early OOM Daemon for Linux - -# Install-time parameters -Conflicts: oomd -%if %{lua:print(rpm.vercmp(rpm.expand('%rpm_version'), '4.13'))} >= 0 -Recommends: libnotify%{?suse_version:-tools} -%endif -Requires(post): insserv-compat - -# Build-time parameters -BuildRequires: pandoc -%if %{with systemd} -BuildRequires: pkgconfig(systemd) -%endif -BuildRoot: %{_tmppath}/%{name}-root -ExclusiveOS: Linux -Source0: %{realname}-%{version}.%{srcext} -Source11: earlyoom.sysconfig -Source12: earlyoom.init -Source13: earlyoom.upstart - -%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). - -# Preparation step (unpackung and patching if necessary) -%prep -%setup -q -n %{realname}-%{version}%{?extraver} -# Fix defaults file location -%{__sed} -i 's|/default/|/sysconfig/|' earlyoom.service.in -# CentOS' gzip does not have option `-k` -%{__sed} -i 's|gzip -f -k.*$|gzip -c $< > $@|' Makefile -# Fix LDFLAGS handling -%{__sed} -ri '/LDFLAGS/ s|$| -lrt|' Makefile - -# Build step (compile/build binaries, documentation, etc) -%build -_CFLAGS='%{optflags} %{?gcc_lto} -Wall -Wextra -DVERSION=\"%{version}\" -fstack-protector-all -std=gnu99' -_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}' -%{__make} %{?_smp_mflags} \ - CFLAGS="$_CFLAGS" \ - LDFLAGS="$_LDFLAGS" - -# Install built stuff -%install -%{__make} install DESTDIR=%{buildroot} \ -%if %{with systemd} - SYSTEMDUNITDIR=%{_unitdir} \ -%endif - PREFIX=%{_prefix} -%if 0%{?suse_version} -%{__install} -D -m644 %{S:11} %{buildroot}%{_fillupdir}/sysconfig.%{name} -%else -%{__install} -D -m644 %{S:11} %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%endif -%if ! %{with systemd} -%if %{with upstart} -%{__install} -D -m644 %{S:13} %{buildroot}%{_sysconfdir}/init/%{name} -%else -%{__install} -D -m755 %{S:12} %{buildroot}%{_initrddir}/%{name} -%endif -%endif - -# Cleanup -%clean -[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} - -# Files list -%files -%defattr(-,root,root) -%doc LICENSE MANPAGE.md README.md -%{_bindir}/earlyoom -%if %{with systemd} -%{_unitdir}/%{name}.service -%else -%if %{with upstart} -%{_sysconfdir}/init/%{name} -%else -%{_initrddir}/%{name} -%endif -%exclude %{_sysconfdir}/systemd/system/earlyoom.service -%endif -%exclude %{_sysconfdir}/default/earlyoom -%if 0%{?suse_version} -%{_fillupdir}/sysconfig.%{name} -%else -%{_sysconfdir}/sysconfig/%{name} -%endif -%doc %{_mandir}/man1/earlyoom.1* - -%if 0%{?suse_version} - -%if 0%{?_unitdir:1} -%pre -%{service_add_pre %{name}.service} -%endif - -%post -%if 0%{?_unitdir:1} -%{fillup_only %{name}} -%{service_add_post %{name}.service} -%else -%{fillup_and_insserv %{name}} -%endif - -%preun -%if 0%{?_unitdir:1} -%{service_del_preun %{name}.service} -%else -%{stop_on_removal %{name}} -%endif - -%postun -%if 0%{?_unitdir:1} -%{service_del_postun %{name}.service} -%else -%{restart_on_update %{name}} -%endif -%{insserv_cleanup} - -%endif -%changelog diff --git a/_service:recompress:tar_scm:earlyoom-1.3.tar.bz2 b/earlyoom-1.3.tar.bz2 similarity index 100% rename from _service:recompress:tar_scm:earlyoom-1.3.tar.bz2 rename to earlyoom-1.3.tar.bz2 diff --git a/earlyoom.changes b/earlyoom.changes index 16c9a8f..5410767 100644 --- a/earlyoom.changes +++ b/earlyoom.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jan 6 16:00:16 UTC 2020 - opensuse.lietuviu.kalba@gmail.com + +- Clean-up. + ------------------------------------------------------------------- Thu Jun 6 07:18:05 UTC 2019 - Alexander Evseev diff --git a/earlyoom.init b/earlyoom.init index 8163b50..c8d736d 100644 --- a/earlyoom.init +++ b/earlyoom.init @@ -28,7 +28,7 @@ else FAILURE="failure; echo" fi -[ -r /etc/sysconfig/earlyoom ] && source /etc/sysconfig/earlyoom || EARLYOOM_ARGS="-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|ssh|yast|yast2|zypper|rpm)$' --prefer '(^|/)(java|chromium|firefox|opera|akregator|thumbnail.so)$'" +[ -r /etc/sysconfig/earlyoom ] && source /etc/sysconfig/earlyoom || EARLYOOM_ARGS="-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|ssdm|kdm|gdm|lightdm|ssh|yast|yast2|y2controlcenter|zypper|rpm)$' --prefer '(^|/)(java|firefox|chromium|chrome|opera|ffmpeg|vlc|akregator|thumbnail.so)$'" EARLYOOM_BIN=/usr/bin/earlyoom EARLYOOM_PID=/var/run/earlyoom.pid diff --git a/earlyoom.spec b/earlyoom.spec index 8520d08..9103e21 100644 --- a/earlyoom.spec +++ b/earlyoom.spec @@ -1,51 +1,52 @@ -%define realname earlyoom -%define srcext tar.bz2 +# +# spec file for package earlyoom +# +# Copyright (c) 2020 SUSE LLC +# +# 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. -%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7 +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + +%if 0%{?suse_version} >= 1230 %bcond_without systemd %else %bcond_with systemd %endif -%if 0%{?rhel} && 0%{?rhel} == 6 -%bcond_without upstart -%else -%bcond_with upstart -%endif - -%if ! 0%{?_fillupdir:1} -%global _fillupdir /var/adm/fillup-templates -%endif - %global rpm_version %(rpm -q --qf %%{version} rpm) - +%if ! 0%{?_fillupdir:1} +%global _fillupdir %{_localstatedir}/adm/fillup-templates +%endif # Common info -Name: %{realname} -Version: 0 -Release: wiz%{?extraver:0.}1%{?dist} -License: MIT -Group: System/Daemons -URL: https://github.com/rfjakob/earlyoom -Summary: Early OOM Daemon for Linux - -# Install-time parameters -Conflicts: oomd -%if %{lua:print(rpm.vercmp(rpm.expand('%rpm_version'), '4.13'))} >= 0 -Recommends: libnotify%{?suse_version:-tools} -%endif -Requires(post): insserv-compat - +Name: earlyoom +Version: 1.3 +Release: 0%{?extraver:0.}1%{?dist} +Summary: Early OOM Daemon for Linux +License: MIT +Group: System/Daemons +URL: https://github.com/rfjakob/earlyoom +Source0: %{name}-%{version}.tar.bz2 +Source11: earlyoom.sysconfig +Source12: earlyoom.init # Build-time parameters -BuildRequires: pandoc -%if %{with systemd} -BuildRequires: pkgconfig(systemd) +BuildRequires: pandoc +Requires(post): insserv-compat +# Install-time parameters +Conflicts: oomd +%if %{lua:print(rpm.vercmp(rpm.expand('%{rpm_version}'), '4.13'))} >= 0 +Recommends: libnotify%{?suse_version:-tools} +%endif +%if %{with systemd} +BuildRequires: pkgconfig(systemd) %endif -BuildRoot: %{_tmppath}/%{name}-root -ExclusiveOS: Linux -Source0: %{realname}-%{version}.%{srcext} -Source11: earlyoom.sysconfig -Source12: earlyoom.init -Source13: earlyoom.upstart %description earlyoom checks the amount of available memory and free swap, and if both are @@ -53,70 +54,49 @@ below critical level, it will kill the largest process (highest oom_score). # Preparation step (unpackung and patching if necessary) %prep -%setup -q -n %{realname}-%{version}%{?extraver} +%setup -q -n %{name}-%{version}%{?extraver} # Fix defaults file location -%{__sed} -i 's|/default/|/sysconfig/|' earlyoom.service.in +sed -i 's|/default/|/sysconfig/|' earlyoom.service.in # CentOS' gzip does not have option `-k` -%{__sed} -i 's|gzip -f -k.*$|gzip -c $< > $@|' Makefile +sed -i 's|gzip -f -k.*$|gzip -c $< > $@|' Makefile # Fix LDFLAGS handling -%{__sed} -ri '/LDFLAGS/ s|$| -lrt|' Makefile +sed -ri '/LDFLAGS/ s|$| -lrt|' Makefile # Build step (compile/build binaries, documentation, etc) %build _CFLAGS='%{optflags} %{?gcc_lto} -Wall -Wextra -DVERSION=\"%{version}\" -fstack-protector-all -std=gnu99' _LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}' -%{__make} %{?_smp_mflags} \ +make %{?_smp_mflags} \ CFLAGS="$_CFLAGS" \ LDFLAGS="$_LDFLAGS" # Install built stuff %install -%{__make} install DESTDIR=%{buildroot} \ +make install DESTDIR=%{buildroot} \ %if %{with systemd} SYSTEMDUNITDIR=%{_unitdir} \ %endif - PREFIX=%{_prefix} -%if 0%{?suse_version} -%{__install} -D -m644 %{S:11} %{buildroot}%{_fillupdir}/sysconfig.%{name} -%else -%{__install} -D -m644 %{S:11} %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%endif +PREFIX=%{_prefix} +install -D -m644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name} %if ! %{with systemd} -%if %{with upstart} -%{__install} -D -m644 %{S:13} %{buildroot}%{_sysconfdir}/init/%{name} -%else -%{__install} -D -m755 %{S:12} %{buildroot}%{_initrddir}/%{name} +install -D -m755 %{SOURCE12} %{buildroot}%{_initddir}/%{name} %endif -%endif - -# Cleanup -%clean -[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} # Files list %files -%defattr(-,root,root) -%doc LICENSE MANPAGE.md README.md +%license LICENSE +%doc MANPAGE.md README.md %{_bindir}/earlyoom %if %{with systemd} %{_unitdir}/%{name}.service %else -%if %{with upstart} -%{_sysconfdir}/init/%{name} -%else -%{_initrddir}/%{name} -%endif +%{_initddir}/%{name} %exclude %{_sysconfdir}/systemd/system/earlyoom.service %endif %exclude %{_sysconfdir}/default/earlyoom -%if 0%{?suse_version} %{_fillupdir}/sysconfig.%{name} -%else -%{_sysconfdir}/sysconfig/%{name} -%endif -%doc %{_mandir}/man1/earlyoom.1* +%{_mandir}/man1/earlyoom.1%{?ext_man} -%if 0%{?suse_version} %if 0%{?_unitdir:1} %pre @@ -144,7 +124,6 @@ _LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}' %else %{restart_on_update %{name}} %endif -%{insserv_cleanup} +%insserv_cleanup -%endif %changelog diff --git a/earlyoom.sysconfig b/earlyoom.sysconfig index cf483ad..9c07b74 100644 --- a/earlyoom.sysconfig +++ b/earlyoom.sysconfig @@ -2,11 +2,11 @@ ## Description: configuration for Early OOM Daemon ## Type: string -## Default: "-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|ssh|yast|yast2|zypper|rpm)$' --prefer '(^|/)(java|chromium|firefox|opera|akregator|thumbnail.so)$'" +## Default: "-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|ssdm|kdm|gdm|lightdm|ssh|yast|yast2|y2controlcenter|zypper|rpm)$' --prefer '(^|/)(java|firefox|chromium|chrome|opera|ffmpeg|vlc|akregator|thumbnail.so)$'" ## Config: earlyoom # # Command-line options to pass to earlyoom # # see man(1) earlyoom # -EARLYOOM_ARGS="-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|ssh|yast|yast2|zypper|rpm)$' --prefer '(^|/)(java|chromium|firefox|opera|akregator|thumbnail.so)$'" +EARLYOOM_ARGS="-r 3 -m 10 -s 20 -n --avoid '(^|/)(systemd|Xorg|X|Xwayland|xdm|ssdm|kdm|gdm|lightdm|ssh|yast|yast2|y2controlcenter|zypper|rpm)$' --prefer '(^|/)(java|firefox|chromium|chrome|opera|ffmpeg|vlc|akregator|thumbnail.so)$'" diff --git a/earlyoom.upstart b/earlyoom.upstart deleted file mode 100644 index 884ed4b..0000000 --- a/earlyoom.upstart +++ /dev/null @@ -1,15 +0,0 @@ -description "Early OOM killer daemon" - -start on runlevel [2345] -stop on runlevel [016] -respawn - -script - mkfifo /tmp/earlyoom-log-fifo - ( logger -t earlyoom < /tmp/earlyoom-log-fifo & ) - exec >> /tmp/earlyoom-log-fifo 2>&1 - rm -f /tmp/earlyoom-log-fifo - - . /etc/sysconfig/earlyoom - exec /usr/bin/earlyoom ${EARLYOOM_ARGS:--r 60} -end script