Accepting request 761530 from home:embar-:branches:Base:System
further cleanup OBS-URL: https://build.opensuse.org/request/show/761530 OBS-URL: https://build.opensuse.org/package/show/Base:System/earlyoom?expand=0&rev=3
This commit is contained in:
parent
03fe6a0587
commit
7ee727b5fb
@ -1,69 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# chkconfig: 345 11 89
|
||||
# description: Early OOM Killer daemon
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: earlyoom
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Early OOM Killer
|
||||
# Description: A userspace service that will kill the largest process
|
||||
# (by VmRSS residential size) when free RAM drops below 10%.
|
||||
### END INIT INFO
|
||||
|
||||
if [ -r /etc/rc.status ]; then
|
||||
source /etc/rc.status
|
||||
START="/sbin/startproc"
|
||||
STATUS="/sbin/checkproc"
|
||||
SUCCESS="echo \$rc_done"
|
||||
FAILURE="echo \$rc_failed"
|
||||
else
|
||||
source /etc/rc.d/init.d/functions
|
||||
START="daemon"
|
||||
STATUS="status"
|
||||
SUCCESS="success; echo"
|
||||
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|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
|
||||
|
||||
RETVAL=0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting earlyoom: "
|
||||
${START} ${EARLYOOM_BIN} ${EARLYOOM_ARGS}
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping earlyoom: "
|
||||
killproc -p ${EARLYOOM_PID} ${EARLYOOM_BIN}
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
unset RETVAL
|
||||
;;
|
||||
reload|force-reload)
|
||||
RETVAL=3
|
||||
;;
|
||||
status)
|
||||
echo -n "Status of earlyoom: "
|
||||
${STATUS} ${EARLYOOM_BIN} > /dev/null 2>&1
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|usage}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
[ -z ${RETVAL} ] && exit
|
||||
[ ${RETVAL} -eq 0 ] && eval "${SUCCESS}" || eval "${FAILURE}"
|
||||
exit ${RETVAL}
|
@ -15,17 +15,11 @@
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
%if 0%{?suse_version} >= 1230
|
||||
%bcond_without systemd
|
||||
%else
|
||||
%bcond_with systemd
|
||||
%endif
|
||||
|
||||
%global rpm_version %(rpm -q --qf %%{version} rpm)
|
||||
%if ! 0%{?_fillupdir:1}
|
||||
%global _fillupdir %{_localstatedir}/adm/fillup-templates
|
||||
%endif
|
||||
# Common info
|
||||
Name: earlyoom
|
||||
Version: 1.3
|
||||
Release: 0%{?extraver:0.}1%{?dist}
|
||||
@ -35,18 +29,13 @@ Group: System/Daemons
|
||||
URL: https://github.com/rfjakob/earlyoom
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
Source11: earlyoom.sysconfig
|
||||
Source12: earlyoom.init
|
||||
# Build-time parameters
|
||||
# pandoc only for `pandoc MANPAGE.md -s -t man > earlyoom.1`, thus could be excluded if earlyoom.1 would be provided.
|
||||
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
|
||||
BuildRequires: pkgconfig(systemd)
|
||||
%endif
|
||||
Requires(post): insserv-compat
|
||||
Recommends: libnotify%{?suse_version:-tools}
|
||||
Conflicts: oomd
|
||||
|
||||
%description
|
||||
earlyoom checks the amount of available memory and free swap, and if both are
|
||||
@ -73,31 +62,20 @@ make %{?_smp_mflags} \
|
||||
# Install built stuff
|
||||
%install
|
||||
make install DESTDIR=%{buildroot} \
|
||||
%if %{with systemd}
|
||||
SYSTEMDUNITDIR=%{_unitdir} \
|
||||
%endif
|
||||
PREFIX=%{_prefix}
|
||||
PREFIX=%{_prefix}
|
||||
install -D -m644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name}
|
||||
%if ! %{with systemd}
|
||||
install -D -m755 %{SOURCE12} %{buildroot}%{_initddir}/%{name}
|
||||
%endif
|
||||
|
||||
# Files list
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc MANPAGE.md README.md
|
||||
%{_bindir}/earlyoom
|
||||
%if %{with systemd}
|
||||
%{_unitdir}/%{name}.service
|
||||
%else
|
||||
%{_initddir}/%{name}
|
||||
%exclude %{_sysconfdir}/systemd/system/earlyoom.service
|
||||
%endif
|
||||
%exclude %{_sysconfdir}/default/earlyoom
|
||||
%{_fillupdir}/sysconfig.%{name}
|
||||
%{_mandir}/man1/earlyoom.1%{?ext_man}
|
||||
|
||||
|
||||
%if 0%{?_unitdir:1}
|
||||
%pre
|
||||
%{service_add_pre %{name}.service}
|
||||
|
Loading…
x
Reference in New Issue
Block a user