Blob Blame History Raw
Name:           tlp
Version:        0.5
Release:        2%{?dist}
Summary:        Advanced power management tool for Linux
License:        GPLv2+
URL:            http://linrunner.de/tlp
Source0:        https://github.com/linrunner/TLP/archive/%{version}.tar.gz
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
#The following requires are not detected:
Requires:       ethtool
Requires:       hdparm
Requires:       iw
Requires:       redhat-lsb-core
Requires:       rfkill
Requires:       systemd
Requires:       udev
Requires:       usbutils
Requires:       wireless-tools
#Conflicts with laptop-mode-tools, note that an official
#package/package name doesn't exist, so this works for now:
Conflicts:      %{_sbindir}/laptop_mode
BuildArch:      noarch

%description
TLP brings you the benefits of advanced power management for Linux
without the need to understand every technical detail. TLP comes
with a default configuration already optimized for battery life.
Also an optional install of the smartmontools package enables hard
disk SMART data in tlp-stat (smartctl).

%package rdw
Summary:        Radio Device Wizard for TLP
Requires:       NetworkManager
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description rdw
Radio Device Wizard for TLP automatically toggles wireless networking
based on dock events and the Network Manager connection status.

%prep
%setup -q -n TLP-%{version}
sed -i 's|/lib/udev|/usr/lib/udev|g' tlp*rules Makefile
sed -i 's|init.d|rc.d/init.d|g' Makefile
#Bash completion should be in /usr/share
sed -i 's|etc/bash_completion.d|usr/share/bash-completion/completions|g' Makefile

%build
make

%install
make install DESTDIR=%{buildroot} TLP_NO_PMUTILS=1
#Install manpages:
mkdir -p %{buildroot}%{_mandir}/{man1,man8}
install -m 0644 man/*.1 %{buildroot}%{_mandir}/man1
install -m 0644 man/*.8 %{buildroot}%{_mandir}/man8

%files
%config(noreplace) %{_sysconfdir}/default/tlp
%doc COPYING LICENSE README
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/man*/*
#Explicit use of lib is required, see "Libexecdir"/"Multilib Exempt Locations":
#https://fedoraproject.org/wiki/Packaging:Guidelines#Filesystem_Layout
%{_prefix}/lib/tlp-pm
%{udevdir}/rules.d/40-tlp.rules
%{udevdir}/rules.d/../tlp-usb-udev
%{_datadir}/bash-completion/completions/tlp
%{_initddir}/tlp
#The following is not supported by fedora's kernel:
%exclude %{_sysconfdir}/acpi/events/thinkpad-radiosw
%exclude %{_sysconfdir}/acpi/thinkpad-radiosw.sh
 
%files rdw
%doc COPYING LICENSE README
%{_sysconfdir}/NetworkManager/dispatcher.d/99tlp-rdw-nm
%{udevdir}/rules.d/40-tlp-rdw.rules
%{udevdir}/rules.d/../tlp-rdw-udev

%post
/sbin/chkconfig --add tlp

%preun
if [ $1 -eq 0 ] ; then
    /sbin/service tlp stop >/dev/null 2>&1
    /sbin/chkconfig --del tlp
fi

%postun
if [ "$1" -ge "1" ] ; then
    /sbin/service tlp condrestart >/dev/null 2>&1 || :
fi

%post rdw
/bin/systemctl enable NetworkManager-dispatcher.service >/dev/null 2>&1 || :

%changelog
* Mon Apr 21 2014 Jeremy Newton <alexjnewt@hotmail.com> - 0.5-2
- Various tweaking
- Move bashcompletion file to silence rpmlint warning

* Sun Apr 20 2014 Jeremy Newton <alexjnewt@hotmail.com> - 0.5-1
- Initial fedora package