File hdparm.spec of Package hdparm

#
# spec file for package hdparm (Version 9.12)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           hdparm
License:        Any permissive
Group:          Hardware/Other
PreReq:         %insserv_prereq %fillup_prereq coreutils
Provides:       base:/sbin/hdparm
AutoReqProv:    on
Version:        9.12
Release:        1
Summary:        A Program to Get and Set Hard Disk Parameters
Source:         %{name}-%{version}.tar.bz2
Source1:        56-idedma.rules
Source2:        sysconfig.ide
Source3:        udev.idedma.sh
Patch1:         %{name}-%{version}-nostrip.patch
Url:            http://sourceforge.net/projects/hdparm/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A shell utility to access and tune the ioctl features of the Linux IDE
driver and IDE drives.



Authors:
--------
    Mark Lord

%prep
%setup -q
%patch1

%build
make CFLAGS="$RPM_OPT_FLAGS -Wall -Wstrict-prototypes" LDFLAGS=
%ifarch %ix86
gcc $RPM_OPT_FLAGS -c contrib/fix_standby.c -o contrib/fix_standby
%endif

%install
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8
make install DESTDIR=$RPM_BUILD_ROOT
mv contrib/README contrib/README.contrib
install -d $RPM_BUILD_ROOT/etc/udev/rules.d
install -m 644 %{S:1} $RPM_BUILD_ROOT/etc/udev/rules.d
install -d $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{S:2} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -d $RPM_BUILD_ROOT/lib/udev
install -m 755 %{S:3} $RPM_BUILD_ROOT/lib/udev/idedma.sh
install -d $RPM_BUILD_ROOT/usr/lib/hdparm
%ifarch %ix86
install -m 755 contrib/fix_standby $RPM_BUILD_ROOT/usr/lib/hdparm
%endif
install -m 755 contrib/idectl $RPM_BUILD_ROOT/usr/lib/hdparm
install -m 755 contrib/ultrabayd $RPM_BUILD_ROOT/usr/lib/hdparm

%post
if [ -f etc/sysconfig/hardware ] ; then
  mv etc/sysconfig/hardware etc/sysconfig/ide
fi
%{remove_and_set -n ide DEVICES_FORCE_IDE_DMA_ON DEVICES_FORCE_IDE_DMA_OFF}
%{fillup_only -n ide}
# new settings
NEW_DMA=""
# convert old settings
if [ "$DEVICES_FORCE_IDE_DMA_ON" != "" -a "$DEVICES_FORCE_IDE_DMA_ON" != "no" ] ; then
  for dev in $DEVICES_FORCE_IDE_DMA_ON; do
    NEW_DMA="${NEW_DMA:+$NEW_DMA }/dev/$dev:on"
  done
fi
if [ "$DEVICES_FORCE_IDE_DMA_OFF" != "" -a "$DEVICES_FORCE_IDE_DMA_OFF" != "no" ] ; then
  for dev in $DEVICES_FORCE_IDE_DMA_OFF; do
    NEW_DMA="${NEW_DMA:+$NEW_DMA }/dev/$dev:off"
  done
fi
# update sysconfig file
if [ "$NEW_DMA" != "" ] ; then
    echo "Updating etc/sysconfig/ide"
    # remove old values, update new variable
    sed -e "s|^DEVICES_FORCE_IDE_DMA=\"\\(.*\\)\"|DEVICES_FORCE_IDE_DMA=\"$NEW_DMA \\1\"|" \
        etc/sysconfig/ide > etc/sysconfig/ide.new \
      && mv etc/sysconfig/ide.new etc/sysconfig/ide
    rm -f etc/sysconfig/ide.new
fi

%files
%defattr(-,root,root)
%doc Changelog README.acoustic contrib/README.contrib
%doc %{_mandir}/man8/hdparm.8.gz
/sbin/hdparm
%dir /lib/udev
/lib/udev/idedma.sh
%dir /etc/udev
%dir /etc/udev/rules.d
%config(noreplace) /etc/udev/rules.d/56-idedma.rules
/usr/lib/hdparm
/var/adm/fillup-templates/sysconfig.ide

%changelog
* Mon Mar 02 2009 mseben@suse.cz
- update to version 9.12
  * added logical/physical sector size reporting
  * updated -I output with SATA-2.6 additions
  * support APM level retrieval with -B flag
  * updated -C output to match ATA8
  * added "form factor" and "rotation" display to -I, courtesy of Martin K.Petersen.
* Mon Feb 16 2009 mseben@suse.cz
- update to version 9.11
  * switch back to ATA_16 by default: required by libata for ATAPI devices
  * add --prefer-ata12 to force use of ATA_12 when needed (some USB enclosures)
* Fri Jan 30 2009 mseben@suse.cz
- update to version 9.10
  * try and improve CF card detection
  * fix display of mwdma modes 3,4 for CF cards
* Mon Jan 26 2009 mseben@suse.cz
- update to version 9.9
  * recalculate cyls when kernel returns a truncated value
* Thu Jan 15 2009 mseben@suse.cz
- update to version 9.8
  * fix -N  to correctly use top 4 LBA bits on non-LBA48 drives
- version 9.7
  * FIX RATHER NASTY LBA48/LBA28 CONFUSION BUGS
  * use ATA_12 by default (helps USB), ATA_16 only when needed for LBA48
* Tue Jan 06 2009 mseben@suse.cz
- update to version 9.6
  * fix -N for 1.5TB drives (from Justin Maggard)
- version 9.5
  * byteswap ID strings for fwdownload workarounds
  * Makefile fixes for $(STRIP) from Wolfram Sang
- version 9.4
  * nuked --fwdownload80 in favour of model-specific workarounds
  * use mlock() instead of MAP_POPULATE in fwdownload.c
  * issue SET_STREAMING command as part of -E (for newer CD/DVD drives)
  courtesy of Thomas Orgis <thomas@orgis.org>
  and Thomas Fritzsche" <tf@noto.de>.
- version 9.3
  * new --idle-immediate and --idle-unload commands
- version 9.2
  * fix WWN output from -I
- version 9.1
  * tidy up output from --dco-identify, add more info to manpage
  * add kernel (device driver) bug detection/warning to -N output
- version 9.0
  * update debian directory contents
  * add --dco-freeze, --dco-identify, --dco-restore flags
  * fix sgio.c to be more clever around the lba28 boundary
  * add supposedly obsolete "cache/buffer size" reporting to -I
  * new --fwdownload flag
  * fix error reporting from sg16().
  * dump entire returned sense desc[] in sgio.c with --verbose
- rewritten hdparm-*-nostrip.patch for version 9.6
* Tue Aug 12 2008 lmichnovic@suse.cz
- update to version 8.9
  * Add compatibility for /sys/block/ symlinks, as seen on some
  distro kernels.
- version 8.8
  * Fixed bugs in -r, -a, and -Q flags.
- version 8.7
  * fixes to permit building against older kernels which lack SG_IO
  * added build script for empeg systems
  * removed -R, -U flags: kernel support is broken and being removed
  * fixed IO_support output
  * prevent error messages from default flags
  * added sysfs.c, geom.c, fibmap.c
  * use sysfs for device start_lba/nsectors values whereever
  possible (for >= 2TB drives)
  * new standalone --fibmap and --fibmap-sector flags
  * converted -Q to access the queue_depth attribute from sysfs
  (now works for SATA!)
  * fixed readonly issue with optical drives that some people
  noticed
* Wed Feb 27 2008 lmichnovic@suse.cz
- update to version 8.6
  * add partition safeguards to r/w sector and make_bad_sector
* Mon Feb 25 2008 lmichnovic@suse.cz
- update to version 8.5
  * fix u8->u16 bug in security commands for all of 8.x series, from
  Christian Franke
  * try and quiet errors from flush_buffer_cache()
  (obsoletes *silence.patch)
* Wed Feb 20 2008 lmichnovic@suse.cz
- *silence.patch changed after discussion with author
* Wed Feb 20 2008 lmichnovic@suse.cz
- update to 8.4
  * Changes since 8.3
 - Fix --write-sector breakage from v8.3
  * Changes since 8.2
 - fixed -i display for udma6
 - try and exit with errno on fail paths, from Ladislav Michnovic
  obsoletes *err_return.patch
* Tue Feb 19 2008 lmichnovic@suse.cz
- rewritten *silence.patch, *err_return.patch
* Tue Feb 19 2008 lmichnovic@suse.cz
- update to version 8.2
- Fixed sector ops (and other stuff) to work with non-libata IDE
  driver again.
  * Changes since 8.1
 - clear feat register for safety with SET_MAX_ADDRESS command
 - add note to manpage regarding possible -N transient failures
 - IDE_TASKFILE bug fixes and cleanups: works with old IDE driver
 - fix misreporting of dma modes on some SATA-ATAPI bridged drives
* Mon Feb 18 2008 lmichnovic@suse.cz
- update to version 8.1
  * Changes since 8.0
 - fixed -U parameter bug
 - added ATA8 minor revision info to -I, courtesy of chrfranke
 - added WorldWideNumber to -I, courtesy of Raksac
  * Changes since 7.7
 - added --make-bad-sector to deliberately create a media error
 - added --write-sector (aka. --repair-sector) to repair a media
  error
 - added --read-sector to test for a media error
 - Makefile dependency tweaks
 - added -N (get/set max address/HPA) flag
 - fixed LBAsects output from -i to use LBA48 values when
  available
 - fixed alternate opcode for SLEEPNOW
 - lots of changes/fixes to sgio.c to support more commands
 - add detection of buggy Sandisk 16MB CF card
 - fixed tf_to_lba() bug, courtesy of Jakub Bogusz
* Fri Nov 30 2007 ro@suse.de
- added sd* to udev rule (#340039)
* Fri Aug 10 2007 ro@suse.de
- update to 7.7
  - fixed bug whereby old data was shown after settings changed (eg. with -W0)
  - removed old notes about a "correction factor" from man page -tT descriptions
  - retry open with O_RDONLY if O_RDWR fails with errno==EROFS
* Tue Jun 19 2007 ro@suse.de
- update to 7.6
  - added -F flag to flush on-drive write cache buffer
  - replaced use of shm* functions with of mmap()/mlock()
  - removed gcc -Wextra flag --> unsupported on Debian Sarge
  - re-allow use of --security-freeze in combination with other flags
* Thu Jun 07 2007 ro@suse.de
- update to 7.5
  - beef up warnings for -s1 flag, as people seem to be ignoring them
* Fri Jun 01 2007 ro@suse.de
- update to 7.4
  - ignore ENOTTY response from DRIVE_CMD(NULL)
  - decode CFA advanced timing information
* Thu May 24 2007 schwab@suse.de
- fix_standby is x86-only.
* Wed May 16 2007 ro@suse.de
- fix lint problems
  - install contrib scripts to /usr/lib/hdparm
  - mark udev file as config
  - fix permissions for fillup-template
* Mon Apr 30 2007 schwab@suse.de
- Don't strip binaries.
* Mon Apr 30 2007 ro@suse.de
- update to 7.3
  - fixed spelling of --drq-hsm-error in -h output
  - fixed SG_IO CDB[2] bits for better SAT compliance
  - fixed version number (v7.2 has "7.1" as version, doh!)
  - added #ifdef around use of BLKGETSIZE64
  - manpage updated
* Sun Apr 29 2007 ro@suse.de
- update to 7.2
  - tweak -C
  - added more debug info from --verbose
  - added --drq-hsm-error to test libata EH (VERY DANGEROUS, do not use)
  - fixed breakage when used with old IDE driver
* Sun Apr 29 2007 ro@suse.de
- update to 7.1
  - big-endian fixes for -I, --Istdin, --Istdout
  - cody tidying in sgio.c
  - updated help/manpage for -v
  - marked -s1 as (DANGEROUS)
- hdparm-7.0
  - new command-line parser
  - allow any chars (except 0x00) in security passwords
  - fixed -s manpage format error
  - updated -W manpage description
  - major internal rework in hdparm.c
  - added SET_FEATURES subcommand 0x07 to the -s0 sequence
  (the kernel will eventually have to do this automatically)
  - fixed duplicate display of udma modes 3,4,5 with -i
  - added Timed-Command-Completion (TLC) data for -I
  - added support for SG_IO (SAT) ATA_16 command transport
  - ignore case for longargs (eg. --istdout or --Istdout)
  - remove dependencies on <linux/hdreg.h>
  - added query wcache (-W)
  - enhanced query acoustic (-M)
  - added kernel_patches directory with patches for ATAPI support
- disable acoustic patch (surrounding code changed)
* Sat Oct 28 2006 aj@suse.de
- Update to version 6.9, changes since 6.6 are:
  * added -s flag to control power-up in standby
  * make --Istdin more robust
  * added -I recognition of SMART Command Transport (SCT)
  * fix X2 over-reporting of -T results
  * add udma 3/4/5 modes to the -i results
  * improve parsing/operation of --Istdin function
  * don't default to "-v" when only new "--" longopts are used.
  * calculate integrity word if not correct
  * remove used code/parameter from identify()
  * fix "(null)" strings from the "Drive conforms to" line of -I
  * tidied up usage of prefix vars in Makefile
  * fix bug in -C implementation
  * new -H flag for (Hitachi) drive temperature
* Mon Jun 12 2006 ro@suse.de
- update to version 6.6
  - manpage updates / corrections.
  - fixed bug in -C code.
  - major updates to bring -I information up to current specs.
* Mon May 22 2006 schwab@suse.de
- Don't strip binaries.
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Nov 30 2005 ro@suse.de
- moved udev helper script to /lib/udev
* Tue Oct 25 2005 ro@suse.de
- update to version 6.3
* Fri Oct 07 2005 ro@suse.de
- added udev rule 56-idedma.rules
- moved sysconfig/ide from aaa_base to this package
  (and all the legacy postinstall code with it)
* Mon Apr 18 2005 ro@suse.de
- update to 6.1
* Tue Mar 08 2005 ro@suse.de
- use HDIO_SET_ACOUSTIC
* Fri Feb 11 2005 ro@suse.de
- update to 5.9
* Wed Feb 02 2005 ro@suse.de
- fix set acoustic (#48595)
* Fri Nov 05 2004 ro@suse.de
- update to 5.8
- remove-dup-swap.patch has been merged upstream
* Wed Oct 20 2004 ro@suse.de
- silence errors for BLKFLSBUF (#45057)
* Tue Oct 12 2004 ro@suse.de
- added contrib files to doc (#47105)
* Sat Sep 04 2004 ro@suse.de
- update to 5.7
- removed obsolete lvm patch
- recreated err_return patch again
* Tue Aug 17 2004 ro@suse.de
- update to 5.6
- recreated err_return patch
- readahead.patch is obsolete
* Wed May 12 2004 meissner@suse.de
- Removed duplicated byte swapping on big endian, it
  is no longer needed. (SUSE#39628/LTC#7961)
* Tue Feb 03 2004 ro@suse.de
- update to hdparm-5.5
- added limited support for SCSI(-controlled) CDROM/optical drives
* Tue Jan 27 2004 ro@suse.de
- rename variable readahead (glibc using this as a function)
* Thu Nov 06 2003 ro@suse.de
- added README.acoustic (#32917)
* Mon Oct 20 2003 ro@suse.de
- use defattr
- don't build as root
* Sun Jul 06 2003 ro@suse.de
- update to 5.4 with new timing code
* Tue Jun 03 2003 olh@suse.de
- add hdparm-5.3-dump_identity-endian.dif
  do not swap the id->cur_capacity0/1 values in userland
* Mon May 12 2003 ro@suse.de
- define LVM_BLK_MAJOR if not defined
* Wed Mar 26 2003 ro@suse.de
- fix timing test for large disks (#25861)
* Wed Mar 12 2003 ro@suse.de
- added patch to return an error for most failed ioctls
  (not all, because cdroms always fail for e.g. HDIO_GETGEO)
* Wed Nov 27 2002 ro@suse.de
- update (v5.3 endian fixes, other stuff)
* Thu Aug 01 2002 ro@suse.de
- update to 5.2
  . updated -Q to take queue depth as parameter value
  . formatting fixes for -I from various people
  . updated -I to most recent ATA6 draft standard
  . various compile fixes
* Thu Apr 25 2002 ro@suse.de
- added patch from axboe to make TCQ work
* Thu Apr 25 2002 ro@suse.de
- up to vanilla hdparm-4.7
- use buildroot
* Tue Sep 04 2001 ro@suse.de
- update to 4.1 (mostly merged changes from andre's patch)
* Thu Mar 22 2001 ro@suse.de
- added split-aliases as provides
* Thu Mar 15 2001 ro@suse.de
- split from base
openSUSE Build Service is sponsored by