From 71e40923f1b4d36158974e4a4f3d9441d231e7dc Mon Sep 17 00:00:00 2001 From: Harvie Date: Tue, 3 May 2011 16:54:56 +0200 Subject: [PATCH] mcelog - new rc.d script --- mcelog/PKGBUILD | 20 +++++++++++--------- mcelog/mcelog.rc | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 mcelog/mcelog.rc diff --git a/mcelog/PKGBUILD b/mcelog/PKGBUILD index 24dcc79..aba0599 100644 --- a/mcelog/PKGBUILD +++ b/mcelog/PKGBUILD @@ -4,25 +4,27 @@ pkgname=mcelog pkgver=1.0pre3 -pkgrel=1 +pkgrel=2 pkgdesc="Print machine check event log from x86-64 kernel" url="http://freshmeat.net/projects/mcelog/" license="GPL" arch=('i686' 'x86_64') depends=() -source=("ftp://ftp.kernel.org/pub/linux/utils/cpu/mce/${pkgname}-${pkgver}.tar.gz") -md5sums=('b42f2214de6f4feb992556149edc67fa') +source=("ftp://ftp.kernel.org/pub/linux/utils/cpu/mce/${pkgname}-${pkgver}.tar.gz" + "${pkgname}.rc") +md5sums=('b42f2214de6f4feb992556149edc67fa' + 'f039a77d7bde3518d3d695b144816e8a') build() { cd "${srcdir}/${pkgname}-${pkgver}" make - mkdir -p ${pkgdir}/usr/sbin/ - cp mcelog ${pkgdir}/usr/sbin/ - cp mcelog.cron ${pkgdir}/usr/sbin/ + mkdir -p "${pkgdir}/usr/sbin/" + cp mcelog "${pkgdir}/usr/sbin/" + cp mcelog.cron "${pkgdir}/usr/sbin/" - mkdir -p ${pkgdir}/etc/rc.d/ - cp mcelog.init ${pkgdir}/etc/rc.d/mcelog + mkdir -p "${pkgdir}/etc/rc.d/" + cp "${srcdir}/mcelog.rc" "${pkgdir}/etc/rc.d/mcelog" - chmod -R 755 ${pkgdir}/ + chmod -R 755 "${pkgdir}/" } diff --git a/mcelog/mcelog.rc b/mcelog/mcelog.rc new file mode 100644 index 0000000..fb73743 --- /dev/null +++ b/mcelog/mcelog.rc @@ -0,0 +1,37 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/mcelog` +case "$1" in + start) + stat_busy "Starting mcelog" + if [ -z "$PID" ]; then + /usr/sbin/mcelog --daemon --pidfile /var/run/mcelog.pid + fi + if [ ! -z "$PID" -o $? -gt 0 ]; then + stat_fail + else + add_daemon mcelog + stat_done + fi + ;; + stop) + stat_busy "Stopping mcelog" + [ ! -z "$PID" ] && kill $PID &>/dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon mcelog + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac -- 2.30.2