- kudzu is deprecated, replace it with HAL (#195752)
- moved later in the boot process so haldaemon is already running when drives are being detected
This commit is contained in:
parent
00e7554f8c
commit
c4ce3923f3
@ -1,9 +1,36 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Copyright 2004 Red Hat, Inc. Distributed under the GPL.
|
# Copyright 2004-2006 Red Hat, Inc. Distributed under the GPL.
|
||||||
# Author: Will Woods <wwoods@redhat.com>
|
# Authors: Will Woods <wwoods@redhat.com>, Tomas Mraz <tmraz@redhat.com>
|
||||||
import kudzu
|
|
||||||
import os
|
import os
|
||||||
drives=kudzu.probe(kudzu.CLASS_HD,kudzu.BUS_IDE|kudzu.BUS_SCSI,kudzu.PROBE_ALL)
|
import dbus
|
||||||
|
|
||||||
|
class Drive:
|
||||||
|
def __init__(self, bus, device, sysfspath):
|
||||||
|
self.bus = bus
|
||||||
|
self.device = device
|
||||||
|
self.sysfspath = sysfspath
|
||||||
|
|
||||||
|
def listDrivesbyHAL():
|
||||||
|
drives = []
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
halm_obj = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
|
||||||
|
halm = dbus.Interface(halm_obj, 'org.freedesktop.Hal.Manager')
|
||||||
|
|
||||||
|
storage_udi_list = halm.FindDeviceByCapability('storage')
|
||||||
|
for udi in storage_udi_list:
|
||||||
|
drive_obj = bus.get_object('org.freedesktop.Hal', udi)
|
||||||
|
drive = dbus.Interface(drive_obj, 'org.freedesktop.Hal.Device')
|
||||||
|
storage_bus = drive.GetProperty('storage.bus')
|
||||||
|
drive_type = drive.GetProperty('storage.drive_type')
|
||||||
|
if (storage_bus == 'ide' or storage_bus == 'scsi') and drive_type == 'disk':
|
||||||
|
device_file = drive.GetProperty('block.device')
|
||||||
|
sysfs_path = drive.GetProperty('linux.sysfs_path')
|
||||||
|
drv = Drive(storage_bus, device_file, sysfs_path)
|
||||||
|
drives += [drv]
|
||||||
|
return drives
|
||||||
|
|
||||||
|
drives = listDrivesbyHAL()
|
||||||
|
|
||||||
print """# *SMARTD*AUTOGENERATED* /etc/smartd.conf
|
print """# *SMARTD*AUTOGENERATED* /etc/smartd.conf
|
||||||
# Remove the line above if you have edited the file and you do not want
|
# Remove the line above if you have edited the file and you do not want
|
||||||
@ -47,19 +74,19 @@ def getfile(fname):
|
|||||||
return line
|
return line
|
||||||
|
|
||||||
for drive in drives:
|
for drive in drives:
|
||||||
if getfile("/sys/block/%s/removable" % drive.device) == '0':
|
if getfile("%s/removable" % drive.sysfspath) == '0':
|
||||||
driver = ''
|
driver = ''
|
||||||
comment = ''
|
comment = ''
|
||||||
if getfile("/sys/block/%s/device/vendor" % drive.device) == 'ATA':
|
if getfile("%s/device/vendor" % drive.sysfspath) == 'ATA':
|
||||||
driver = '-d ata '
|
driver = '-d ata '
|
||||||
if float(getfile("/sys/module/libata/version")) < 1.20:
|
if float(getfile("/sys/module/libata/version")) < 1.20:
|
||||||
comment = "# not yet supported in this kernel version\n# "
|
comment = "# not yet supported in this kernel version\n# "
|
||||||
if not comment:
|
if not comment:
|
||||||
status = os.system("/usr/sbin/smartctl -i %s/dev/%s 2>&1 >/dev/null" %
|
status = os.system("/usr/sbin/smartctl -i %s%s 2>&1 >/dev/null" %
|
||||||
(driver, drive.device))
|
(driver, drive.device))
|
||||||
if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
|
if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
|
||||||
comment = "# smartctl -i returns error for this drive\n# "
|
comment = "# smartctl -i returns error for this drive\n# "
|
||||||
print "%s/dev/%s %s-H -m root" % (comment, drive.device, driver)
|
print "%s%s %s-H -m root" % (comment, drive.device, driver)
|
||||||
|
|
||||||
print """
|
print """
|
||||||
# First two SCSI disks. This will monitor everything that smartd can
|
# First two SCSI disks. This will monitor everything that smartd can
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
# smartmontools init file for smartd
|
# smartmontools init file for smartd
|
||||||
# Copyright (C) 2002-4 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
# Copyright (C) 2002-4 Bruce Allen <smartmontools-support@lists.sourceforge.net>
|
||||||
# $Id: smartd.initd,v 1.2 2006/05/02 13:47:46 tmraz Exp $
|
# $Id: smartd.initd,v 1.3 2006/06/27 15:40:29 tmraz Exp $
|
||||||
|
|
||||||
# For RedHat and cousins:
|
# For RedHat and cousins:
|
||||||
# chkconfig: 2345 40 40
|
# chkconfig: 2345 99 01
|
||||||
# description: Self Monitoring and Reporting Technology (SMART) Daemon
|
# description: Self Monitoring and Reporting Technology (SMART) Daemon
|
||||||
# processname: smartd
|
# processname: smartd
|
||||||
|
|
||||||
@ -37,7 +37,9 @@ case "$1" in
|
|||||||
start | reload | restart)
|
start | reload | restart)
|
||||||
GEN_CONF="*SMARTD*AUTOGENERATED*"
|
GEN_CONF="*SMARTD*AUTOGENERATED*"
|
||||||
[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </etc/smartd.conf \
|
[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </etc/smartd.conf \
|
||||||
&& [ $GEN_CONF == "*SMARTD*AUTOGENERATED*" ] && smartd-conf.py >/etc/smartd.conf
|
&& [ $GEN_CONF == "*SMARTD*AUTOGENERATED*" ] \
|
||||||
|
&& smartd-conf.py 2>/dev/null >/etc/smartd.conf.new-autogenerated \
|
||||||
|
&& mv -f /etc/smartd.conf.new-autogenerated /etc/smartd.conf
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Tools for monitoring SMART capable hard disks
|
Summary: Tools for monitoring SMART capable hard disks
|
||||||
Name: smartmontools
|
Name: smartmontools
|
||||||
Version: 5.36
|
Version: 5.36
|
||||||
Release: 1
|
Release: 2
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: GPL
|
License: GPL
|
||||||
@ -15,7 +15,7 @@ Patch1: http://people.fedora.de/rsc/smartmontools-5.36-cciss.patch
|
|||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||||
PreReq: /sbin/chkconfig /sbin/service
|
PreReq: /sbin/chkconfig /sbin/service
|
||||||
Requires: fileutils kudzu
|
Requires: fileutils hal >= 0.5.2 dbus-python >= 0.33
|
||||||
BuildRequires: readline-devel ncurses-devel /usr/bin/aclocal /usr/bin/automake /usr/bin/autoconf util-linux groff gettext
|
BuildRequires: readline-devel ncurses-devel /usr/bin/aclocal /usr/bin/automake /usr/bin/autoconf util-linux groff gettext
|
||||||
Obsoletes: kernel-utils
|
Obsoletes: kernel-utils
|
||||||
ExclusiveArch: i386 x86_64 ia64 ppc ppc64
|
ExclusiveArch: i386 x86_64 ia64 ppc ppc64
|
||||||
@ -76,6 +76,11 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 27 2006 Tomas Mraz <tmraz@redhat.com> - 1:5.36-2
|
||||||
|
- kudzu is deprecated, replace it with HAL (#195752)
|
||||||
|
- moved later in the boot process so haldaemon is already running
|
||||||
|
when drives are being detected
|
||||||
|
|
||||||
* Thu May 11 2006 Tomas Mraz <tmraz@redhat.com> - 1:5.36-1
|
* Thu May 11 2006 Tomas Mraz <tmraz@redhat.com> - 1:5.36-1
|
||||||
- new upstream version
|
- new upstream version
|
||||||
- included patch with support for cciss controllers (#191288)
|
- included patch with support for cciss controllers (#191288)
|
||||||
|
Loading…
Reference in New Issue
Block a user