Name: thinkfan
Version: 0.8.1
Release: 3%{?dist}
Summary: A simple fan control program
Group: Applications/System
License: GPLv3+
URL: http://thinkfan.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: thinkfan.modprobe
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
A simple fan control program. Works with any Linux hwmon driver,
especially with thinkpad_acpi. It is designed to eat as little
CPU power as possible.
%prep
%setup -q
# Make man page documentation UTF-8
iconv -f ISO-8859-1 -t UTF-8 thinkfan.1 > thinkfan.1.new
rm thinkfan.1
mv thinkfan.1.new thinkfan.1
%build
CFLAGS="-ggdb" make %{?_smp_mflags}
%install
# Install unit file
install -d $RPM_BUILD_ROOT%{_unitdir}
install -pm 0644 rcscripts/thinkfan.service $RPM_BUILD_ROOT%{_unitdir}
# Install configuration file
install -d $RPM_BUILD_ROOT%{_sysconfdir}
install -pm 0644 examples/thinkfan.conf.thinkpad $RPM_BUILD_ROOT%{_sysconfdir}/thinkfan.conf
# Install modprobe configuration file
install -d $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
install -pm 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/thinkfan.conf
# Install thinkfan daemon
install -d $RPM_BUILD_ROOT%{_sbindir}
install -pm 0755 thinkfan $RPM_BUILD_ROOT%{_sbindir}
# Install manpages
install -d $RPM_BUILD_ROOT%{_mandir}/man1
install -pm 0644 thinkfan.1 $RPM_BUILD_ROOT%{_mandir}/man1
%post
%systemd_post thinkfan.service
%preun
%systemd_preun thinkfan.service
%postun
%systemd_postun_with_restart thinkfan.service
%files
%{_sbindir}/thinkfan
%{_unitdir}/thinkfan.service
%config(noreplace) %{_sysconfdir}/thinkfan.conf
%config(noreplace) %{_sysconfdir}/modprobe.d/thinkfan.conf
%{_mandir}/man1/thinkfan.1.*
%doc examples ChangeLog README NEWS COPYING
%changelog
* Sun Jul 07 2013 Matt Spaulding <mspaulding06@gmail.com> - 0.8.1-3
- Fix config file location and man pages (RHBZ#982011)
* Mon Oct 01 2012 Matt Spaulding <mspaulding06@gmail.com> - 0.8.1-2
- Fixed license type
- Fixed manpages entry in files section
* Sat Sep 29 2012 Matt Spaulding <mspaulding06@gmail.com> - 0.8.1-1
- Initial packaging