Accepting request 205189 from home:elvigia:branches:Base:System
- Cleanup spec file - activate mcelog service via udev+systemd combo, if the kernel registers a /dev/mcelog device the service will be automatically started. - drop sysvinit scripts, add appropiate %pre %post invocations of the needed systemd macros. OBS-URL: https://build.opensuse.org/request/show/205189 OBS-URL: https://build.opensuse.org/package/show/Base:System/mcelog?expand=0&rev=31
This commit is contained in:
parent
85d54dd1f7
commit
326e49c3ae
2
90-mcelog.rules
Normal file
2
90-mcelog.rules
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ACTION=="add", KERNEL=="mcelog", SUBSYSTEM=="misc", TAG+="systemd", ENV{SYSTEMD_WANTS}+="mcelog.service"
|
||||||
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Oct 27 18:00:04 UTC 2013 - crrodriguez@opensuse.org
|
||||||
|
|
||||||
|
- Cleanup spec file
|
||||||
|
- activate mcelog service via udev+systemd combo, if the kernel
|
||||||
|
registers a /dev/mcelog device the service will be automatically
|
||||||
|
started.
|
||||||
|
- drop sysvinit scripts, add appropiate %pre %post invocations
|
||||||
|
of the needed systemd macros.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Oct 15 17:02:13 UTC 2013 - trenn@suse.de
|
Tue Oct 15 17:02:13 UTC 2013 - trenn@suse.de
|
||||||
|
|
||||||
|
117
mcelog.service
117
mcelog.service
@ -1,117 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009 by Thomas Renninger <trenn@suse.de>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: mcelog
|
|
||||||
# Required-Start:
|
|
||||||
# Should-Start: $remote_fs $network $syslog
|
|
||||||
# Required-Stop:
|
|
||||||
# Should-Stop: $remote_fs $network $syslog
|
|
||||||
# Default-Start: 2 3 5
|
|
||||||
# Default-Stop:
|
|
||||||
# Short-Description: Machine Check Architecture/Error (MCA/MCE) implementations
|
|
||||||
# Description: Depending on the configuration, the mcelog service will log
|
|
||||||
# HW initiated Machine Check Exceptions or also react on them intelligently
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
. /etc/rc.status
|
|
||||||
[ -r /etc/sysconfig/mcelog ] && . /etc/sysconfig/mcelog
|
|
||||||
|
|
||||||
# Shell functions sourced from /etc/rc.status:
|
|
||||||
# rc_check check and set local and overall rc status
|
|
||||||
# rc_status check and set local and overall rc status
|
|
||||||
# rc_status -v ditto but be verbose in local rc status
|
|
||||||
# rc_status -v -r ditto and clear the local rc status
|
|
||||||
# rc_failed set local and overall rc status to failed
|
|
||||||
# rc_reset clear local rc status (overall remains)
|
|
||||||
# rc_exit exit appropriate to overall rc status
|
|
||||||
|
|
||||||
# First reset status of this service
|
|
||||||
rc_reset
|
|
||||||
|
|
||||||
mcelog="/usr/sbin/mcelog"
|
|
||||||
mcelog_pid="/var/run/mcelog.pid"
|
|
||||||
mcelog_params=" --daemon --pidfile ${mcelog_pid}"
|
|
||||||
if [ "${MCELOG_ADMIN_EMAIL}x" != "x" ];then
|
|
||||||
mcelog_params="$mcelog_params --email $MCELOG_ADMIN_EMAIL"
|
|
||||||
fi
|
|
||||||
mcedev=/dev/mcelog
|
|
||||||
|
|
||||||
check="checkproc ${mcelog}"
|
|
||||||
kill="killproc ${mcelog}"
|
|
||||||
start="startproc ${mcelog} ${mcelog_params}"
|
|
||||||
|
|
||||||
test_kernel_support()
|
|
||||||
{
|
|
||||||
if [ ! -c ${mcedev} ];then
|
|
||||||
echo -n "$mcedev not found - no kernel or HW support "
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
echo -n "Starting mcelog... "
|
|
||||||
if ! test_kernel_support; then
|
|
||||||
rc_status -u
|
|
||||||
elif ${check};then
|
|
||||||
echo -n "already running"
|
|
||||||
else
|
|
||||||
${start}
|
|
||||||
fi
|
|
||||||
rc_status -v
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
echo -n "Shutting down mcelog... "
|
|
||||||
${kill}
|
|
||||||
rc_status -v
|
|
||||||
;;
|
|
||||||
try-restart)
|
|
||||||
## Do a restart only if the service was active before.
|
|
||||||
$0 status
|
|
||||||
if test $? = 0; then
|
|
||||||
$0 restart
|
|
||||||
else
|
|
||||||
rc_reset # Not running is not a failure.
|
|
||||||
fi
|
|
||||||
# Remember status and be quiet
|
|
||||||
rc_status
|
|
||||||
;;
|
|
||||||
reload|restart)
|
|
||||||
/etc/init.d/mcelog stop
|
|
||||||
/etc/init.d/mcelog start
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
echo -n "Checking for service mcelog... "
|
|
||||||
if ! test_kernel_support; then
|
|
||||||
rc_status -u
|
|
||||||
else
|
|
||||||
${check}
|
|
||||||
rc_status -v
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Usage: $0 {start|stop|restart|reload|status}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
rc_exit
|
|
43
mcelog.spec
43
mcelog.spec
@ -16,7 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Name: mcelog
|
Name: mcelog
|
||||||
Summary: Log Machine Check Events
|
Summary: Log Machine Check Events
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
@ -25,22 +24,19 @@ Version: 1.1
|
|||||||
Release: 0
|
Release: 0
|
||||||
ExclusiveArch: ix86 x86_64
|
ExclusiveArch: ix86 x86_64
|
||||||
BuildRequires: libesmtp-devel
|
BuildRequires: libesmtp-devel
|
||||||
|
BuildRequires: pkgconfig(systemd)
|
||||||
|
BuildRequires: pkgconfig(udev)
|
||||||
Requires: logrotate
|
Requires: logrotate
|
||||||
PreReq: %insserv_prereq %fillup_prereq
|
|
||||||
Source: mcelog-%{version}.tar.bz2
|
Source: mcelog-%{version}.tar.bz2
|
||||||
Source1: mcelog.service
|
|
||||||
Source2: mcelog.sysconfig
|
Source2: mcelog.sysconfig
|
||||||
Source3: mcelog.systemd
|
Source3: mcelog.systemd
|
||||||
|
Source4: 90-mcelog.rules
|
||||||
Source6: README.email_setup
|
Source6: README.email_setup
|
||||||
Patch1: email.patch
|
Patch1: email.patch
|
||||||
Patch2: mcelog_invert_prefill_db_warning.patch
|
Patch2: mcelog_invert_prefill_db_warning.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
PreReq: %fillup_prereq
|
||||||
%if %suse_version > 1220
|
%{?systemd_requires}
|
||||||
%define _unitdir /usr/lib/systemd
|
|
||||||
%else
|
|
||||||
%define _unitdir /lib/systemd
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
mcelog retrieves machine check events from an x86-64 kernel in a cron
|
mcelog retrieves machine check events from an x86-64 kernel in a cron
|
||||||
@ -59,7 +55,7 @@ Authors:
|
|||||||
Andi Kleen <andi@firstfloor.org>
|
Andi Kleen <andi@firstfloor.org>
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup
|
%setup -q
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
|
||||||
@ -72,9 +68,6 @@ export prefix=$RPM_BUILD_ROOT/usr
|
|||||||
export etcprefix=$RPM_BUILD_ROOT
|
export etcprefix=$RPM_BUILD_ROOT
|
||||||
make -e install
|
make -e install
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/
|
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d/
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
|
||||||
install -m755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/mcelog
|
|
||||||
ln -s /etc/init.d/mcelog $RPM_BUILD_ROOT/usr/sbin/rcmcelog
|
|
||||||
install -m644 mcelog.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/mcelog
|
install -m644 mcelog.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/mcelog
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
|
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
|
||||||
@ -83,37 +76,37 @@ install -m 644 %SOURCE2 $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.mcelo
|
|||||||
mkdir -p $RPM_BUILD_ROOT/%_docdir/%name
|
mkdir -p $RPM_BUILD_ROOT/%_docdir/%name
|
||||||
install -m 644 %SOURCE6 $RPM_BUILD_ROOT/%_docdir/%name/README.email_setup
|
install -m 644 %SOURCE6 $RPM_BUILD_ROOT/%_docdir/%name/README.email_setup
|
||||||
install -m 644 lk10-mcelog.pdf $RPM_BUILD_ROOT/%_docdir/%name/lk10-mcelog.pdf
|
install -m 644 lk10-mcelog.pdf $RPM_BUILD_ROOT/%_docdir/%name/lk10-mcelog.pdf
|
||||||
install -D -m 0644 %SOURCE3 %{buildroot}%{_unitdir}/system/mcelog.service
|
install -D -m 0644 %SOURCE3 %{buildroot}%{_unitdir}/mcelog.service
|
||||||
|
install -D -m 0644 %SOURCE4 %{buildroot}%{_udevrulesdir}/90-mcelog.rules
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%pre
|
||||||
|
%service_add_pre %{name}.service
|
||||||
|
|
||||||
%post
|
%post
|
||||||
if [ -c /dev/mcelog ];then
|
%fillup_only
|
||||||
%{fillup_and_insserv -y mcelog}
|
%udev_rules_update
|
||||||
fi
|
%service_add_post %{name}.service
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%{stop_on_removal mcelog}
|
%service_del_preun %{name}.service
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%{restart_on_update mcelog}
|
%service_del_postun %{name}.service
|
||||||
%insserv_cleanup
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr (-,root,root,755)
|
%defattr (-,root,root,755)
|
||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
/usr/sbin/mcelog
|
/usr/sbin/mcelog
|
||||||
%config /etc/logrotate.d/mcelog
|
%config /etc/logrotate.d/mcelog
|
||||||
/etc/init.d/mcelog
|
|
||||||
%dir /etc/mcelog
|
%dir /etc/mcelog
|
||||||
%config /etc/mcelog/mcelog.conf
|
%config /etc/mcelog/mcelog.conf
|
||||||
/var/adm/fillup-templates/sysconfig.mcelog
|
/var/adm/fillup-templates/sysconfig.mcelog
|
||||||
/etc/mcelog/*trigger
|
/etc/mcelog/*trigger
|
||||||
/usr/sbin/rcmcelog
|
%{_unitdir}/mcelog.service
|
||||||
%dir %{_unitdir}
|
%{_udevrulesdir}/90-mcelog.rules
|
||||||
%dir %{_unitdir}/system
|
|
||||||
%{_unitdir}/system/mcelog.service
|
|
||||||
%_docdir/%name
|
%_docdir/%name
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Machine Check Exception Logging Daemon
|
Description=Machine Check Exception Logging Daemon
|
||||||
After=syslog.target
|
|
||||||
ConditionVirtualization=false
|
ConditionVirtualization=false
|
||||||
ConditionPathExists=/dev/mcelog
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=-/etc/sysconfig/mcelog
|
EnvironmentFile=-/etc/sysconfig/mcelog
|
||||||
|
Loading…
Reference in New Issue
Block a user