File smartmontools.spec of Package smartmontools

#
# spec file for package smartmontools (Version 5.37)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           smartmontools
License:        GPL v2 or later
Group:          Hardware/Other
AutoReqProv:    on
Version:        5.37
Release:        15.1
Source:         %{name}-%{version}.tar.bz2
Source1:        README.SATA
Patch:          smartmontools-powersave-notify.patch
Patch1:         smartmontools-default-enabled.patch
Patch2:         smartmontools-array_subscript.patch
Patch3:         smartmontools-incl.patch
Patch4:         smartmontools-command-convert.patch
Patch5:         smartmontools-command-convert2.patch
Patch6:         smartmontools-lsb-init-script.patch
PreReq:         %insserv_prereq %fillup_prereq coreutils
%if %suse_version > 1000
Requires:       powersave
%endif
%if %suse_version > 1020
Requires:       licenses
BuildRequires:  licenses
%endif
%if %suse_version < 1000
BuildRequires:  kernel-source
%endif
Url:            http://smartmontools.sourceforge.net/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc-c++ libstdc++-devel
Summary:        Monitor for S.M.A.R.T. Disks and Devices
Obsoletes:      smartctl smartd ucsc-smartsuite smartsuite

%description
SMARTmontools controls and monitors storage devices using the
Self-Monitoring, Analysis, and Reporting Technology System (S.M.A.R.T.)
built into ATA, SATA and SCSI Hard Drives. This is used to check the
hard drive reliability and to predict drive failures. The suite
contains two utilities. The first, smartctl, is a command line utility
designed to perform simple S.M.A.R.T. tasks. The second, smartd, is a
daemon that periodically monitors the smart status and reports errors
to syslog. The package is compatible with the ATA/ATAPI-3 to -7
specification. The package is intended to incorporate as much "vendor
specific" and "reserved" information as possible about disk drives. The
commands man smartctl and man smartd will provide more information.



Authors:
--------
    Bruce Allen <smartmontools-support@lists.sourceforge.net>

%prep
%setup
cp -a %{S:1} .
%if %suse_version > 1000
%patch
%endif
%if %suse_version >= 1010
%patch1
%endif
# Fixed in CVS:
%patch2
# Fixed in CVS:
%patch3
%patch4 -p1
%patch5
%patch6

%build
AUTOMAKE="%{_bindir}/automake" ./autogen.sh
%if %suse_version >= 1000
export CFLAGS="$RPM_OPT_FLAGS -fPIE"
export CXXFLAGS="$RPM_OPT_FLAGS -fPIE"
export LDFLAGS="-pie"
%else
# glibc header linux/cciss_ioctl.h is broken and outdated in SLES9 (#302136). Let's use the one from kernel:
export CPPFLAGS=-I/usr/src/linux/include
%endif
%configure\
	--with-docdir=%{_defaultdocdir}/%{name}
make %{?jobs:-j%jobs}

%install
%makeinstall
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
cp smartd.initd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/smartd
chmod +x $RPM_BUILD_ROOT%{_sysconfdir}/init.d/smartd
ln -s ../..%{_sysconfdir}/init.d/smartd $RPM_BUILD_ROOT%{_sbindir}/rcsmartd
%if %suse_version > 1000
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/smartmontools
cp examplescripts/Example4 $RPM_BUILD_ROOT%{_prefix}/lib/smartmontools/smart-notify
chmod +x $RPM_BUILD_ROOT%{_prefix}/lib/smartmontools/smart-notify
%endif
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/default
echo '#smartd_opts=""' >$RPM_BUILD_ROOT%{_sysconfdir}/default/smartmontools
%if %suse_version < 1010
cp README.SATA $RPM_BUILD_ROOT%{_datadir}/doc/packages/%{name}/
%endif
#remove installed files we don't want to package
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/
%if %suse_version > 1020
ln -sf %{_datadir}/doc/licenses/md5/$(md5sum COPYING | sed 's/ .*//') $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYING
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%pre
# Older SuSE versions (<=10.2) don't do restart on update. Test it and set flag.
# This file exists since smartmontools-5.37:
if ! test -f usr/share/doc/packages/smartmontools/examplescripts/Example4 ; then
    touch var/adm/smartd_needs_restart
fi

%post
%if %suse_version < 1010
# With some broken drivers in older kernels, smartd can hang the system.
# Don't start it by default.
%{fillup_and_insserv -f smartd}
%else
# Turn smartd on by default.
%{fillup_and_insserv -f -Y smartd}
%endif
# Older SuSE versions (<=10.2) don't do restart on update. Do it now.
if test -f var/adm/smartd_needs_restart ; then
rm var/adm/smartd_needs_restart
%{restart_on_update smartd}
fi

%preun
%{stop_on_removal smartd}

%postun
%{restart_on_update smartd}
%{insserv_cleanup}

%files
%defattr(-, root, root)
%doc %{_docdir}/%{name}
%doc %{_mandir}/man*/*
%if %suse_version > 1000
%{_prefix}/lib/smartmontools
%endif
%{_sbindir}/*
%config(noreplace) %{_sysconfdir}/default/*
%{_sysconfdir}/init.d/*
%config(noreplace) %{_sysconfdir}/*.conf
%changelog
* Tue Oct 09 2007 - sbrabec@suse.cz
- Fixed incorrectly backported patch which could cause crashes with
  Highpoint RAID (225639#c3).
* Wed Aug 22 2007 - sbrabec@suse.cz
- Worked around missing %%restart_on_update in older versions.
- Build correctly in older SuSE versions.
* Tue Jul 24 2007 - sbrabec@suse.cz
- Updated to version 5.37:
  * Rely on general SAT code instead of Linux specific.
  * Increased max line length 128 to 256 characters.
  * Added new items into drive database.
  * Fixed inclusion of PRI?64 macros from inttypes.h.
  * Fix selective self test log revision number.
  * Compile fix for SuSE.
- Really start smartd by default on new enough kernels (#201715).
- Fixed behavior for SATA discs (#225639).
* Mon Mar 05 2007 - pgajdos@suse.cz
- fixed 'array subscript is above array bounds' (#239956)
* Mon Jan 22 2007 - ssommer@suse.de
- fix build for automake-0.9b
* Thu Jan 18 2007 - ssommer@suse.de
- support building with automake-1.10
* Wed Oct 25 2006 - sbrabec@suse.cz
- Updated to the today CVS version:
  * Supports SATA devices scanning out of the box (#201715#c9).
  * Supports SATA devices behind SCSI ATA Translation layer.
  * Supports SATA drives behind HighPoint Raid controllers.
  * Supports HP SmartArray RAID controller (cciss) (#186013).
- Updated SATA support stuff.
- Start smartd by default on new enough kernels (#201715).
* Wed Sep 13 2006 - sbrabec@suse.cz
- Integrated with powersave.
- Use upstream init script.
* Thu Sep 07 2006 - sbrabec@suse.cz
- Updated to version 5.36:
  * Additions to the table of known drives.
  * Works 'out of the box' with Linux SATA libata.
  * smartd option added to list test schedules.
  * smartctl option added to list part of drive database.
  * Various improvements for SCSI disks and logs.
  * Printing of drive family info.
  * SCSI disks: output size of grown defect list.
  * Added info about drive family to 'smartctl -i' output.
  * Added option ',q' for smartd '-n' directive to suppress
  'skipping checks' message which may spin up laptop disk.
  * Added message if smartd '-n' check power mode spins up disk.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Jun 21 2005 - ro@suse.de
- use RPM_OPT_FLAGS
- build with fPIE/pie
* Fri Mar 18 2005 - sbrabec@suse.cz
- Additional information on SATA support.
* Tue Feb 22 2005 - sbrabec@suse.cz
- Added comments on temperature data in smartd.conf (#50156).
* Mon Jan 24 2005 - sbrabec@suse.cz
- Updated to version 5.33.
* Mon Jan 03 2005 - sbrabec@suse.cz
- Fixed missing pid reference in init script (#49546).
- Updated README.SATA.
* Fri Aug 27 2004 - sbrabec@suse.cz
- Updated to version 5.32.
* Sun Jun 06 2004 - lmuelle@suse.de
- Update to version 5.31.
- Add stop_on_removal to preun and restart_on_update to postun.
* Sun Apr 25 2004 - lmuelle@suse.de
- Add reload and condrestart to init script; [#39425].
* Mon Mar 08 2004 - sbrabec@suse.cz
- Updated to version 5.30.
* Fri Mar 05 2004 - sbrabec@suse.cz
- Added README.SATA.
- Added %%build section.
* Tue Mar 02 2004 - sbrabec@suse.cz
- Updated to version 5.29.
* Mon Jan 12 2004 - adrian@suse.de
- build as user
* Fri Jan 09 2004 - mmj@suse.de
- Updated to version 5.26
* Fri Aug 22 2003 - sbrabec@suse.cz
- Updated to version 5.1-18.
* Thu Aug 21 2003 - sbrabec@suse.cz
- Updated to version 5.1-17.
* Mon Aug 11 2003 - sbrabec@suse.cz
- Added $sendmail to X-UnitedLinux-Should-Start.
* Thu Aug 07 2003 - sbrabec@suse.cz
- Updated to version 5.1.16.
* Wed May 21 2003 - sbrabec@suse.cz
- Updated to version 5.1.9.
- Fixed RPM file attributes.
* Wed Mar 26 2003 - sbrabec@suse.cz
- Updated to version 5.1.9.
* Mon Jan 27 2003 - sbrabec@suse.cz
- Updated to version 5.1.4.
* Mon Jan 13 2003 - sbrabec@suse.cz
- Updated to version 5.1.1.
* Tue Dec 10 2002 - sbrabec@suse.cz
- Updated to version 5.0.49.
* Mon Nov 25 2002 - sbrabec@suse.cz
- Fixed SuSE specific things in docs and manual pages.
* Mon Nov 18 2002 - sbrabec@suse.cz
- New package.
openSUSE Build Service is sponsored by