hdparm/hdparm.spec
2014-09-25 05:47:51 +00:00

122 lines
4.0 KiB
RPMSpec

#
# spec file for package hdparm
#
# Copyright (c) 2014 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/
#
Name: hdparm
PreReq: %fillup_prereq coreutils
Provides: base:/sbin/hdparm
Version: 9.43
Release: 0
Summary: A Program to get and set hard disk parameters
License: SUSE-Permissive
Group: Hardware/Other
Source: http://sourceforge.net/projects/hdparm/files/hdparm/%{name}-%{version}.tar.gz
Source1: 56-idedma.rules
Source2: sysconfig.ide
Source3: udev.idedma.sh
Patch1: hdparm-nostrip.patch
Patch2: hdparm-wiper-warn.patch
Patch3: hdparm-leak-fix.patch
BuildRequires: pkgconfig
BuildRequires: pkgconfig(udev)
Url: http://sourceforge.net/projects/hdparm/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{!?_udevdir: %global _udevdir %(pkg-config --variable=udevdir udev) }
%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d }
%description
A shell utility to access and tune the ioctl features of the Linux IDE
driver and IDE drives.
%prep
%setup -q
%patch1
%patch2 -p1
%patch3
%build
make CFLAGS="$RPM_OPT_FLAGS -Wall -Wstrict-prototypes" LDFLAGS= CC="%{__cc}"
cp -p wiper/README.txt README.wiper
%install
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8
install -d $RPM_BUILD_ROOT/%{_sbindir}
%make_install binprefix=%{_prefix}
mv contrib/README contrib/README.contrib
install -d $RPM_BUILD_ROOT%{_udevrulesdir}
install -m 644 %{S:1} $RPM_BUILD_ROOT%{_udevrulesdir}
install -d $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{S:2} $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 755 %{S:3} $RPM_BUILD_ROOT/%{_udevdir}/idedma.sh
install -d $RPM_BUILD_ROOT/usr/lib/hdparm
install -m 755 contrib/idectl $RPM_BUILD_ROOT/usr/lib/hdparm
install -m 755 contrib/ultrabayd $RPM_BUILD_ROOT/usr/lib/hdparm
install -m 755 wiper/wiper.sh $RPM_BUILD_ROOT/%{_sbindir}
#UsrMerge
mkdir -p $RPM_BUILD_ROOT/sbin
ln -sf %{_sbindir}/wiper.sh $RPM_BUILD_ROOT/sbin
ln -sf %{_sbindir}/hdparm $RPM_BUILD_ROOT/sbin
#EndUsrMerge
%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
%{?udev_rules_update:%{udev_rules_update}}
%files
%defattr(-,root,root)
%doc Changelog README.acoustic contrib/README.contrib README.wiper
%doc %{_mandir}/man8/hdparm.8.gz
#UsrMerge
/sbin/hdparm
/sbin/wiper.sh
#EndUserMerge
%{_sbindir}/hdparm
%{_sbindir}/wiper.sh
%{_udevdir}/idedma.sh
%{_udevrulesdir}/56-idedma.rules
/usr/lib/hdparm
/var/adm/fillup-templates/sysconfig.ide
%changelog