From b34dd23a3e3ca6ce2c715708aa85b2b182f821ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Mr=C3=A1z?= Date: Wed, 22 Mar 2006 16:14:08 +0000 Subject: [PATCH] - add default /etc/sysconfig/smartmontools file - ignore errors on startup (#186130) - test drive for SMART support before adding it to smartd.conf --- smartd-conf.py | 7 ++++++- smartmontools.spec | 10 +++++++++- smartmontools.sysconf | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 smartmontools.sysconf diff --git a/smartd-conf.py b/smartd-conf.py index 300f60f..2fbc78a 100755 --- a/smartd-conf.py +++ b/smartd-conf.py @@ -2,6 +2,7 @@ # Copyright 2004 Red Hat, Inc. Distributed under the GPL. # Author: Will Woods import kudzu +import os drives=kudzu.probe(kudzu.CLASS_HD,kudzu.BUS_IDE|kudzu.BUS_SCSI,kudzu.PROBE_ALL) print """# /etc/smartd.conf @@ -50,7 +51,11 @@ for drive in drives: if getfile("/sys/block/%s/device/vendor" % drive.device) == 'ATA': driver = '-d ata ' if float(getfile("/sys/module/libata/version")) < 1.20: - comment = "# not yet supported in this kernel version " + comment = "# not yet supported in this kernel version\n# " + if not comment: + status = os.system("/usr/sbin/smartctl -i /dev/%s 2>&1 >/dev/null" % drive.device) + if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0: + comment = "# smartctl -i returns error for this drive\n# " print "%s/dev/%s %s-H -m root" % (comment, drive.device, driver) print """ diff --git a/smartmontools.spec b/smartmontools.spec index 6359201..53ddd07 100644 --- a/smartmontools.spec +++ b/smartmontools.spec @@ -1,7 +1,7 @@ Summary: Tools for monitoring SMART capable hard disks Name: smartmontools Version: 5.33 -Release: 4.2 +Release: 5 Epoch: 1 Group: System Environment/Base License: GPL @@ -9,6 +9,7 @@ URL: http://smartmontools.sourceforge.net/ Source0: http://dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.gz Source1: smartd.initd Source2: smartd-conf.py +Source3: smartmontools.sysconf BuildRoot: %{_tmppath}/%{name}-%{version}-root PreReq: /sbin/chkconfig /sbin/service Requires: fileutils kudzu @@ -39,6 +40,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/smartd.conf rm -f examplescripts/Makefile* install -D -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/smartd install -D -m 755 %{SOURCE2} $RPM_BUILD_ROOT%{_sbindir}/smartd-conf.py +install -D -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/smartmontools %clean rm -rf $RPM_BUILD_ROOT @@ -53,6 +55,7 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/rc.d/init.d/smartd %{_mandir}/man?/smart*.* %ghost %verify(not md5 size mtime) %config(noreplace,missingok) %{_sysconfdir}/smartd.conf +%config(noreplace) %{_sysconfdir}/sysconfig/smartmontools %preun if [ "$1" = "0" ] ; then @@ -69,6 +72,11 @@ exit 0 %changelog +* Wed Mar 22 2006 Tomas Mraz - 1:5.33-5 +- add default /etc/sysconfig/smartmontools file +- ignore errors on startup (#186130) +- test drive for SMART support before adding it to smartd.conf + * Fri Feb 10 2006 Jesse Keating - 1:5.33-4.2 - bump again for double-long bug on ppc(64) diff --git a/smartmontools.sysconf b/smartmontools.sysconf new file mode 100644 index 0000000..f16495b --- /dev/null +++ b/smartmontools.sysconf @@ -0,0 +1,2 @@ +# command line options for smartd +smartd_opts=-q never