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:
Marcus Meissner 2013-11-27 08:05:19 +00:00 committed by Git OBS Bridge
parent 85d54dd1f7
commit 326e49c3ae
5 changed files with 30 additions and 144 deletions

2
90-mcelog.rules Normal file
View File

@ -0,0 +1,2 @@
ACTION=="add", KERNEL=="mcelog", SUBSYSTEM=="misc", TAG+="systemd", ENV{SYSTEMD_WANTS}+="mcelog.service"

View File

@ -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

View File

@ -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

View File

@ -16,7 +16,6 @@
#
Name: mcelog
Summary: Log Machine Check Events
License: GPL-2.0+
@ -25,22 +24,19 @@ Version: 1.1
Release: 0
ExclusiveArch: ix86 x86_64
BuildRequires: libesmtp-devel
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
Requires: logrotate
PreReq: %insserv_prereq %fillup_prereq
Source: mcelog-%{version}.tar.bz2
Source1: mcelog.service
Source2: mcelog.sysconfig
Source3: mcelog.systemd
Source4: 90-mcelog.rules
Source6: README.email_setup
Patch1: email.patch
Patch2: mcelog_invert_prefill_db_warning.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %suse_version > 1220
%define _unitdir /usr/lib/systemd
%else
%define _unitdir /lib/systemd
%endif
PreReq: %fillup_prereq
%{?systemd_requires}
%description
mcelog retrieves machine check events from an x86-64 kernel in a cron
@ -59,7 +55,7 @@ Authors:
Andi Kleen <andi@firstfloor.org>
%prep
%setup
%setup -q
%patch1 -p1
%patch2 -p1
@ -72,9 +68,6 @@ export prefix=$RPM_BUILD_ROOT/usr
export etcprefix=$RPM_BUILD_ROOT
make -e install
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
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
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 -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
rm -rf $RPM_BUILD_ROOT
%pre
%service_add_pre %{name}.service
%post
if [ -c /dev/mcelog ];then
%{fillup_and_insserv -y mcelog}
fi
%fillup_only
%udev_rules_update
%service_add_post %{name}.service
%preun
%{stop_on_removal mcelog}
%service_del_preun %{name}.service
%postun
%{restart_on_update mcelog}
%insserv_cleanup
%service_del_postun %{name}.service
%files
%defattr (-,root,root,755)
%{_mandir}/man8/*
/usr/sbin/mcelog
%config /etc/logrotate.d/mcelog
/etc/init.d/mcelog
%dir /etc/mcelog
%config /etc/mcelog/mcelog.conf
/var/adm/fillup-templates/sysconfig.mcelog
/etc/mcelog/*trigger
/usr/sbin/rcmcelog
%dir %{_unitdir}
%dir %{_unitdir}/system
%{_unitdir}/system/mcelog.service
%{_unitdir}/mcelog.service
%{_udevrulesdir}/90-mcelog.rules
%_docdir/%name
%changelog

View File

@ -1,8 +1,6 @@
[Unit]
Description=Machine Check Exception Logging Daemon
After=syslog.target
ConditionVirtualization=false
ConditionPathExists=/dev/mcelog
[Service]
EnvironmentFile=-/etc/sysconfig/mcelog