rpms/smartmontools/devel smartd-conf.py, 1.10, 1.11 smartd.initd, 1.5, 1.6 smartmontools.spec, 1.34, 1.35 smartmontools.sysconf, 1.2, 1.3

Tomas Smetana (tsmetana) fedora-extras-commits at redhat.com
Tue Sep 4 11:59:55 UTC 2007


Author: tsmetana

Update of /cvs/pkgs/rpms/smartmontools/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21853

Modified Files:
	smartd-conf.py smartd.initd smartmontools.spec 
	smartmontools.sysconf 
Log Message:
* Tue Sep 04 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-6
- fix #271741 - smartd-conf.py should allow customization of parameters
- fix #253753 - service starting by default, perhaps shouldn't
- update initscript (related #247058 - initscript review)



Index: smartd-conf.py
===================================================================
RCS file: /cvs/pkgs/rpms/smartmontools/devel/smartd-conf.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- smartd-conf.py	22 Feb 2007 12:13:39 -0000	1.10
+++ smartd-conf.py	4 Sep 2007 11:59:22 -0000	1.11
@@ -7,9 +7,9 @@
 
 class Drive:
     def __init__(self, bus, device, sysfspath):
-	    self.bus = bus
-	    self.device = device
-	    self.sysfspath = sysfspath
+        self.bus = bus
+        self.device = device
+        self.sysfspath = sysfspath
 
 def listDrivesbyHAL():
     drives = []
@@ -19,15 +19,15 @@
 
     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]
+        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()
@@ -66,27 +66,35 @@
 
 def getfile(fname):
     try:
-	fh = open(fname)
+        fh = open(fname)
         line = fh.read().rstrip()
-	fh.close()
+        fh.close()
     except IOError:
-	line = ''
+        line = ''
     return line
 
+try:
+    execfile('/etc/sysconfig/smartmontools')
+except IOError:
+    pass
+
 for drive in drives:
     if getfile("%s/removable" % drive.sysfspath) == '0':
-	driver = ''
-	comment = ''
-	if getfile("%s/device/vendor" % drive.sysfspath) == 'ATA':
-	    driver = '-d ata '
-	    if float(getfile("/sys/module/libata/version")) < 1.20:
-		comment = "# not yet supported in this kernel version\n# "
-	if not comment:
-	    status = os.system("/usr/sbin/smartctl -s on -i %s%s 2>&1 >/dev/null" %
-		(driver, drive.device))
-	    if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
-		comment = "# smartctl -i returns error for this drive\n# "
-	print "%s%s %s-H -m root" % (comment, drive.device, driver)
+        driver = ''
+        comment = ''
+    if getfile("%s/device/vendor" % drive.sysfspath) == 'ATA':
+        driver = '-d ata'
+        if float(getfile("/sys/module/libata/version")) < 1.20:
+            comment = "# not yet supported in this kernel version\n# "
+    if not comment:
+        status = os.system("/usr/sbin/smartctl -s on -i %s%s 2>&1 >/dev/null" %
+        (driver, drive.device))
+        if not os.WIFEXITED(status) or os.WEXITSTATUS(status) != 0:
+            comment = "# smartctl -i returns error for this drive\n# "
+    try:
+        print "%s%s %s %s" % (comment, drive.device, driver, smartd_conf_opts)
+    except NameError:
+        print "%s%s %s -H -m root" % (comment, drive.device, driver)
 
 print """
 # First two SCSI disks.  This will monitor everything that smartd can


Index: smartd.initd
===================================================================
RCS file: /cvs/pkgs/rpms/smartmontools/devel/smartd.initd,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- smartd.initd	21 Jun 2007 13:26:38 -0000	1.5
+++ smartd.initd	4 Sep 2007 11:59:22 -0000	1.6
@@ -5,10 +5,20 @@
 # $Id$
 
 # For RedHat and cousins:
-# chkconfig: 2345 99 01
+# chkconfig: - 99 01
 # description: Self Monitoring and Reporting Technology (SMART) Daemon
 # processname: smartd 
 
+### BEGIN INIT INFO
+# Provides: smartd
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Should-Start:
+# Short-Description: Self Monitoring and Reporting Technology (SMART) Daemon
+# Description: The smartd daemon monitors SMART status of the local hard drives and 
+#   provides advanced warnings of of disk degradation or failures.
+### END INIT INFO
+
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
 # Software Foundation; either version 2, or (at your option) any later
@@ -33,59 +43,98 @@
 
 [ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
 
-case "$1" in
-    start | reload | restart)
-		if [ -x /usr/sbin/smartd-conf.py ]; then
-			GEN_CONF="*SMARTD*AUTOGENERATED*"
-			[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </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
-		fi
-    ;;
-esac
+RETVAL=0
+prog=smartd
+pidfile=/var/lock/subsys/smartd
+
+genconfig()
+{
+	if [ -x /usr/sbin/smartd-conf.py ]; then
+		GEN_CONF="*SMARTD*AUTOGENERATED*"
+		[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </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
+	fi
+}
+
+start()
+{
+	echo -n $"Starting $prog: "
+	daemon $SMARTD_BIN $smartd_opts
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && touch $pidfile
+	return $RETVAL
+}
+
+stop()
+{
+	echo -n $"Shutting down $prog: "
+	killproc $SMARTD_BIN
+	RETVAL=$?
+	echo
+	rm -f $pidfile
+	return $RETVAL
+}
+
+reload()
+{
+	echo -n $"Reloading $prog daemon configuration: "
+	killproc $SMARTD_BIN -HUP
+	RETVAL=$?
+	echo
+	return $RETVAL
+}
+
+report()
+{
+	echo -n $"Checking SMART devices now: "
+	killproc $SMARTD_BIN -USR1
+	RETVAL=$?
+	echo
+	return $RETVAL
+}
 
-    RETVAL=0
-    
-    prog=smartd
-    
-    case "$1" in
+case "$1" in
 	start)
-	    echo -n $"Starting $prog: "
-	    daemon $SMARTD_BIN $smartd_opts
-	    touch /var/lock/subsys/smartd
-	    echo
-	    exit 0
-	    ;;
+		genconfig
+		start
+		;;
 	stop)
-	    echo -n $"Shutting down $prog: "
-	    killproc $SMARTD_BIN
-	    rm -f /var/lock/subsys/smartd
-	    echo
-	    ;;
+		stop
+		;;
 	reload)
-            echo -n $"Reloading $prog daemon configuration: "
-	    killproc $SMARTD_BIN -HUP
-	    RETVAL=$?
-	    echo
-	    ;;
+		genconfig
+		reload
+		;;
 	report)
-	    echo -n $"Checking SMART devices now: "
-	    killproc $SMARTD_BIN -USR1
-	    RETVAL=$?
-	    echo
-            ;;
+		report
+		;;
 	restart)
-	    $0 stop
-	    $0 start
-	    ;;
+		stop
+		genconfig
+		start
+		;;
+	try-restart)
+		if [ -f $pidfile ]; then
+			stop
+			genconfig
+			start
+		fi
+		;;
+	force-reload)
+		genconfig
+		reload || (stop; start)
+		;;
 	status)
-	    status $prog
-	    ;;
+		status $prog
+		RETVAL=$?
+		;;
 	*)
-	    echo $"Usage: $0 {start|stop|reload|report|restart|status}"
-	    RETVAL=1
-    esac
+		echo $"Usage: $0 {start|stop|reload|force-reload|report|restart|try-restart|status}"
+		RETVAL=3
+esac
     
-    exit $RETVAL
+exit $RETVAL
 


Index: smartmontools.spec
===================================================================
RCS file: /cvs/pkgs/rpms/smartmontools/devel/smartmontools.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- smartmontools.spec	20 Aug 2007 11:23:11 -0000	1.34
+++ smartmontools.spec	4 Sep 2007 11:59:22 -0000	1.35
@@ -1,7 +1,7 @@
 Summary:	Tools for monitoring SMART capable hard disks
 Name:		smartmontools
 Version:	5.37
-Release: 	5%{?dist}
+Release: 	6%{?dist}
 Epoch:		1
 Group:		System Environment/Base
 License:	GPLv2+
@@ -91,6 +91,11 @@
 %exclude %{_sbindir}/smartd-conf.py[co]
 
 %changelog
+* Tue Sep 04 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-6
+- fix #271741 - smartd-conf.py should allow customization of parameters
+- fix #253753 - service starting by default, perhaps shouldn't
+- update initscript (related #247058 - initscript review)
+
 * Mon Aug 20 2007 Tomas Smetana <tsmetana at redhat.com> - 1:5.37-5
 - add support for 24 disks on 3ware RAID controllers (related #252055)
 - fix #245442 - add %%{arm} to smartmontools's set of build archs


Index: smartmontools.sysconf
===================================================================
RCS file: /cvs/pkgs/rpms/smartmontools/devel/smartmontools.sysconf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- smartmontools.sysconf	24 Mar 2006 17:50:08 -0000	1.2
+++ smartmontools.sysconf	4 Sep 2007 11:59:22 -0000	1.3
@@ -1,2 +1,4 @@
 # command line options for smartd
 smartd_opts="-q never"
+# autogenerated config file options
+# smartd_conf_opts="-H -m root"




More information about the fedora-extras-commits mailing list