diff --git a/.cvsignore b/.cvsignore index e69de29..a7fbc6f 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +smartmontools-5.33.tar.gz diff --git a/smartd-conf.py b/smartd-conf.py new file mode 100755 index 0000000..3f1ac22 --- /dev/null +++ b/smartd-conf.py @@ -0,0 +1,9 @@ +#!/usr/bin/python +# Copyright 2004 Red Hat, Inc. Distributed under the GPL. +# Author: Will Woods +import kudzu +drives=kudzu.probe(kudzu.CLASS_HD,kudzu.BUS_IDE|kudzu.BUS_SCSI,kudzu.PROBE_ALL) +for drive in drives: + fh=open("/sys/block/%s/removable" % drive.device) + if fh.read(1) == '0': + print "/dev/%s -H -m root@localhost.localdomain" % drive.device diff --git a/smartd.initd b/smartd.initd new file mode 100644 index 0000000..2a4a6f0 --- /dev/null +++ b/smartd.initd @@ -0,0 +1,81 @@ +#! /bin/sh + +# smartmontools init file for smartd +# Copyright (C) 2002-4 Bruce Allen +# $Id: smartd.initd,v 1.1 2005/01/07 06:02:58 davej Exp $ + +# For RedHat and cousins: +# chkconfig: 2345 40 40 +# description: Self Monitoring and Reporting Technology (SMART) Daemon +# processname: smartd + +# 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 +# version. +# You should have received a copy of the GNU General Public License (for +# example COPYING); if not, write to the Free Software Foundation, Inc., 675 +# Mass Ave, Cambridge, MA 02139, USA. +# This code was originally developed as a Senior Thesis by Michael Cornwell +# at the Concurrent Systems Laboratory (now part of the Storage Systems +# Research Center), Jack Baskin School of Engineering, University of +# California, Santa Cruz. http://ssrc.soe.ucsc.edu/. + +# Uncomment the line below to pass options to smartd on startup. +# Note that distribution specific configuration files like +# /etc/{default,sysconfig}/smartmontools might override these +#smartd_opts="--interval=1800" + +SMARTD_BIN=/usr/sbin/smartd + +# Source function library +. /etc/rc.d/init.d/functions + +[ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools + +[ ! -f /etc/smartd.conf ] && smartd-conf.py > /etc/smartd.conf + + RETVAL=0 + + prog=smartd + + case "$1" in + start) + echo -n $"Starting $prog: " + daemon $SMARTD_BIN $smartd_opts + touch /var/lock/subsys/smartd + echo + exit 0 + ;; + stop) + echo -n $"Shutting down $prog: " + killproc $SMARTD_BIN + rm -f /var/lock/subsys/smartd + echo + ;; + reload) + echo -n $"Reloading $prog daemon configuration: " + killproc $SMARTD_BIN -HUP + RETVAL=$? + echo + ;; + report) + echo -n $"Checking SMART devices now: " + killproc $SMARTD_BIN -USR1 + RETVAL=$? + echo + ;; + restart) + $0 stop + $0 start + ;; + status) + status $prog + ;; + *) + echo $"Usage: $0 {start|stop|reload|report|restart|status}" + RETVAL=1 + esac + + exit $RETVAL + diff --git a/smartmontools.spec b/smartmontools.spec new file mode 100644 index 0000000..6821f50 --- /dev/null +++ b/smartmontools.spec @@ -0,0 +1,75 @@ +Summary: Tools for monitoring SMART capable hard disks. +Name: smartmontools +Version: 5.33 +Release: %(R="$Revision: 1.1 $"; RR="${R##: }"; echo ${RR%%?}) +Serial: 1 +Group: System Environment/Base +License: GPL +Source0: smartmontools-5.33.tar.gz +Source1: smartd.initd +Source2: smartd-conf.py +Buildroot: %{_tmppath}/%{name}-%{version}-root +Prereq: /sbin/chkconfig /sbin/service +Requires: fileutils kudzu +BuildPreReq: readline-devel ncurses-devel /usr/bin/aclocal /usr/bin/automake /usr/bin/autoconf util-linux groff gettext +Obsoletes: kernel-utils +ExclusiveArch: i386 x86_64 ia64 ppc64 + +Patch1: smartmontools-smartd.patch + +%description +smartctl - monitor the health of your disks + + +%prep +%setup -q -c -a 0 +%patch1 -p0 + +%build +rm -rf $RPM_BUILD_ROOT + +mkdir -p %{buildroot}/usr/sbin +mkdir -p %{buildroot}/usr/man +mkdir -p %{buildroot}/etc/rc.d/init.d +mkdir -p %{buildroot}/etc/sysconfig + +cd smartmontools-5.33 +%configure +make CFLAGS="$RPM_OPT_FLAGS -fpie -pie -Wl,-z,relro,-z,now" DESTDIR=$RPM_BUILD_ROOT smartd smartctl install + +%install +mkdir -p %{buildroot}/usr/share/man/man{1,8} + +cd smartmontools-5.33 +rm -f %{buildroot}/etc/smartd.conf +rm -f %{buildroot}/etc/rc.d/init.d/smartd.conf +install %{SOURCE1} %{buildroot}/etc/rc.d/init.d/smartd +install %{SOURCE2} %{buildroot}/usr/sbin/smartd-conf.py + +chmod -R a-s %{buildroot} + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; + +%files +%defattr(-,root,root) +%attr(0644,root,root) %{_mandir}/*/* +/usr/sbin/smartd +/usr/sbin/smartctl +/usr/sbin/smartd-conf.py +/etc/rc.d/init.d/smartd +%doc /usr/share/doc/smartmontools-5.33 + +%preun +if [ "$1" = "0" ] ; then + /sbin/service smartd stop + /sbin/chkconfig --del smartd +fi + +%post +/sbin/chkconfig --add smartd + +%changelog +* Sat Dec 18 2004 Dave Jones +- Initial packaging, based upon kernel-utils. + diff --git a/sources b/sources index e69de29..47832ce 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +53f6861a916169a88a9edb1848e27dd0 smartmontools-5.33.tar.gz