Skip to content

Instantly share code, notes, and snippets.

@linrunner
Created September 21, 2019 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linrunner/7cf7a6b2ea901595990bb91820ba12c1 to your computer and use it in GitHub Desktop.
Save linrunner/7cf7a6b2ea901595990bb91820ba12c1 to your computer and use it in GitHub Desktop.
Name: tlp
Version: 1.2.2
Release: 2%{?dist}
Summary: Advanced power management tool for Linux
License: GPLv2+
URL: http://linrunner.de/en/tlp/tlp.html
Source0: https://github.com/linrunner/TLP/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
#Provided by Andreas Roederer <tlp~at~warpnine~dot~de>:
Source1: 50-tlp.preset
BuildRequires: perl-generators
BuildRequires: systemd
BuildRequires: libappstream-glib
#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: pciutils
Recommends: kernel-tools
#Note: Conflicts with laptop-mode-tools
#Makes sure laptop_mode isn't being used:
Conflicts: %{_sbindir}/laptop_mode
BuildArch: noarch
%description
TLP is an advanced power management tool for Linux. It comes with a
default configuration already optimized for battery life. At the same
time it is highly customizable to fulfill specific user requirements.
TLP supplies separate settings profiles for AC and battery power and can
enable or disable Bluetooth, WiFi and WWAN radio devices upon system start-up.
For ThinkPads it provides a unified way to configure charging thresholds and
re-calibrate the battery for all models which support it (via tp-smapi or
acpi-call).
TLP is a pure command line tool with automated background tasks, it
does not contain a GUI.
%package rdw
Summary: Radio Device Wizard for TLP
Requires: NetworkManager
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description rdw
Radio device wizard is an add-on to TLP. It provides event based
switching of:
- Bluetooth, WiFi, WWAN radio devices
- upon network connect/disconnect
- and dock/undock
%prep
%autosetup -n TLP-%{version}
%build
%make_build
%install
%make_install \
TLP_NO_INIT=1 \
TLP_WITH_ELOGIND=0 \
TLP_SYSD=%{_unitdir} \
TLP_ULIB=%{_udevrulesdir}/..
#Install manpages:
make install-man DESTDIR=%{buildroot}
make install-man-rdw DESTDIR=%{buildroot}
#Install preset (source 1):
install -Dpm 0644 %{SOURCE1} %{buildroot}/%{_presetdir}/50-tlp.preset
%check
appstream-util validate-relax --nonet \
%{buildroot}/%{_datadir}/metainfo/*.xml
%files
%config(noreplace) %{_sysconfdir}/default/tlp
%license LICENSE
%doc COPYING README.md changelog
%{_bindir}/*
%exclude %{_bindir}/tlp-rdw
%{_sbindir}/*
%{_mandir}/man*/*
%exclude %{_mandir}/man*/tlp-rdw*
%{_datadir}/tlp
%{_udevrulesdir}/85-tlp.rules
%{_udevrulesdir}/../tlp-usb-udev
%{_datadir}/bash-completion/completions/*
%exclude %{_datadir}/bash-completion/completions/tlp-rdw
%{_presetdir}/50-tlp.preset
%{_unitdir}/*.service
%{_datadir}/metainfo/*.metainfo.xml
%files rdw
%doc COPYING README.md changelog
%{_bindir}/tlp-rdw
%{_mandir}/man*/tlp-rdw*
%{_sysconfdir}/NetworkManager/dispatcher.d/99tlp-rdw-nm
%{_udevrulesdir}/85-tlp-rdw.rules
%{_udevrulesdir}/../tlp-rdw-udev
%{_datadir}/bash-completion/completions/tlp-rdw
%post
%systemd_post tlp.service
%systemd_post tlp-sleep.service
systemctl mask systemd-rfkill.service
%preun
%systemd_preun tlp.service
%systemd_preun tlp-sleep.service
%postun
%systemd_postun_with_restart tlp.service
%systemd_postun_with_restart tlp-sleep.service
if [ $1 -eq 0 ] ; then
systemctl unmask systemd-rfkill.service
fi
%post rdw
/bin/systemctl enable NetworkManager-dispatcher.service >/dev/null 2>&1 || :
%changelog
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jun 10 2019 Jeremy Newton <alexjnewt at hotmail dot com> - 1.2.2-1
- Update to 1.2.2
* Mon Mar 18 2019 Jeremy Newton <alexjnewt at hotmail dot com> - 1.2.1-1
- Update to 1.2.1
- Modernize SPEC file
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment