- add default /etc/sysconfig/smartmontools file

- ignore errors on startup (#186130)
- test drive for SMART support before adding it to smartd.conf
This commit is contained in:
Tomáš Mráz 2006-03-22 16:14:08 +00:00
parent f53d6838e9
commit b34dd23a3e
3 changed files with 17 additions and 2 deletions

View File

@ -2,6 +2,7 @@
# Copyright 2004 Red Hat, Inc. Distributed under the GPL.
# Author: Will Woods <wwoods@redhat.com>
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 """

View File

@ -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 <tmraz@redhat.com> - 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 <jkeating@redhat.com> - 1:5.33-4.2
- bump again for double-long bug on ppc(64)

2
smartmontools.sysconf Normal file
View File

@ -0,0 +1,2 @@
# command line options for smartd
smartd_opts=-q never