summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKang Kai <kai.kang@windriver.com>2014-04-10 10:54:34 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-04-20 11:10:14 +0200
commit206f81e2186779fde7e2099f54a80e094acd352f (patch)
treedee5266b4e312c9b0ba029ea6b0c3d90227e3cf7
parent314b713e7f9f73530a45467bc95dd8d6c8806097 (diff)
downloadmeta-openembedded-206f81e2186779fde7e2099f54a80e094acd352f.tar.gz
smartmontools: add init script
Add init script smartd for smartmontools. Thought smartmontools provides init script itself, but it checks distribution version that is not usable for oe. So add an init script for smartmontools which removes distribution version check. Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rwxr-xr-xmeta-oe/recipes-extended/smartmontools/files/initd.smartd108
-rw-r--r--meta-oe/recipes-extended/smartmontools/smartmontools_6.2.bb14
2 files changed, 120 insertions, 2 deletions
diff --git a/meta-oe/recipes-extended/smartmontools/files/initd.smartd b/meta-oe/recipes-extended/smartmontools/files/initd.smartd
new file mode 100755
index 000000000..29c27e475
--- /dev/null
+++ b/meta-oe/recipes-extended/smartmontools/files/initd.smartd
@@ -0,0 +1,108 @@
1#! /bin/sh
2
3# smartmontools init file for smartd
4# Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
5# $Id: smartd.initd.in 3360 2011-06-06 19:25:36Z chrfranke $
6
7# For RedHat and cousins:
8# chkconfig: - 60 60
9# description: Self Monitoring and Reporting Technology (SMART) Daemon
10# processname: smartd
11
12# For SuSE and cousins
13### BEGIN INIT INFO
14# Provides: smartd
15# Required-Start: $syslog $remote_fs
16# Should-Start: sendmail
17# Required-Stop: $syslog $remote_fs
18# Should-Stop: sendmail
19# Default-Start:
20# Default-Stop: 0 1 2 3 4 5 6
21# Short-Description: Monitors disk and tape health via S.M.A.R.T.
22# Description: Start S.M.A.R.T. disk and tape monitor.
23### END INIT INFO
24
25# This program is free software; you can redistribute it and/or modify it
26# under the terms of the GNU General Public License as published by the Free
27# Software Foundation; either version 2, or (at your option) any later
28# version.
29# You should have received a copy of the GNU General Public License (for
30# example COPYING); if not, write to the Free Software Foundation, Inc., 675
31# Mass Ave, Cambridge, MA 02139, USA.
32# This code was originally developed as a Senior Thesis by Michael Cornwell
33# at the Concurrent Systems Laboratory (now part of the Storage Systems
34# Research Center), Jack Baskin School of Engineering, University of
35# California, Santa Cruz. http://ssrc.soe.ucsc.edu/.
36
37# Uncomment the line below to pass options to smartd on startup.
38# Note that distribution specific configuration files like
39# /etc/{default,sysconfig}/smartmontools might override these
40#smartd_opts="--interval=1800"
41
42SMARTD_BIN=/usr/sbin/smartd
43SMARTDPID=/var/run/smartd.pid
44[ -x $SMARTD_BIN ] || exit 0
45RET=0
46
47# source configuration file
48[ -r /etc/default/rcS ] && . /etc/default/rcS
49[ -r /etc/default/smartmontools ] && . /etc/default/smartmontools
50
51smartd_opts="--pidfile $SMARTDPID $smartd_opts"
52
53case "$1" in
54 start)
55 echo -n "Starting S.M.A.R.T. daemon: smartd"
56 if start-stop-daemon --start --quiet --pidfile $SMARTDPID \
57 --exec $SMARTD_BIN -- $smartd_opts; then
58 echo "."
59 else
60 echo " (failed)"
61 RET=1
62 fi
63 ;;
64 stop)
65 echo -n "Stopping S.M.A.R.T. daemon: smartd"
66 start-stop-daemon --stop --quiet --oknodo --pidfile $SMARTDPID
67 echo "."
68 ;;
69 restart)
70 $0 stop
71 $0 start
72 ;;
73 force-reload)
74 $0 reload || $0 restart
75 ;;
76 reload)
77 echo -n "Reload S.M.A.R.T. daemon: smartd"
78 if start-stop-daemon --stop --quiet --signal 1 \
79 --pidfile $SMARTDPID; then
80 echo "."
81 else
82 echo " (failed)"
83 RET=1
84 fi
85 ;;
86 report)
87 echo -n "Checking SMART devices now"
88 if start-stop-daemon --stop --quiet --signal 10 \
89 --pidfile $SMARTDPID; then
90 echo "."
91 else
92 echo " (failed)"
93 RET=1
94 fi
95 ;;
96 status)
97 if pidof $SMARTD_BIN >/dev/null; then
98 echo "$SMARTD_BIN is running."
99 else
100 echo "$SMARTD_BIN is not running."
101 RET=1
102 fi
103 ;;
104 *)
105 echo "Usage: $0 {start|stop|restart|force-reload|reload|report|status}"
106 exit 1
107esac
108exit $RET
diff --git a/meta-oe/recipes-extended/smartmontools/smartmontools_6.2.bb b/meta-oe/recipes-extended/smartmontools/smartmontools_6.2.bb
index 83ff02884..66fdb4d8d 100644
--- a/meta-oe/recipes-extended/smartmontools/smartmontools_6.2.bb
+++ b/meta-oe/recipes-extended/smartmontools/smartmontools_6.2.bb
@@ -12,10 +12,20 @@ SECTION = "console/utils"
12LICENSE = "GPLv2" 12LICENSE = "GPLv2"
13LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" 13LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
14 14
15SRC_URI = "${SOURCEFORGE_MIRROR}/smartmontools/smartmontools-${PV}.tar.gz" 15SRC_URI = "${SOURCEFORGE_MIRROR}/smartmontools/smartmontools-${PV}.tar.gz \
16 file://initd.smartd \
17 "
16 18
17SRC_URI[md5sum] = "d44f84081a12cef79cd17f78044351fc" 19SRC_URI[md5sum] = "d44f84081a12cef79cd17f78044351fc"
18SRC_URI[sha256sum] = "486f660579bb0fb4f6b927ded7531cb1f99685c666397377761c5b04dd96065b" 20SRC_URI[sha256sum] = "486f660579bb0fb4f6b927ded7531cb1f99685c666397377761c5b04dd96065b"
19 21
20inherit autotools 22inherit autotools update-rc.d
21 23
24do_install_append () {
25 #install the init.d/smartd
26 install -d ${D}${sysconfdir}/init.d
27 install -p -m 0755 ${WORKDIR}/initd.smartd ${D}${sysconfdir}/init.d/smartd
28}
29
30INITSCRIPT_NAME = "smartd"
31INITSCRIPT_PARAMS = "start 60 . stop 60 0 1 2 3 4 5 6 ."