]> git.pld-linux.org Git - packages/laptop-mode-tools.git/blob - laptop-mode-tools.spec
- use arm macro, versioned Obsoletes; obsolete also individual packages, not just...
[packages/laptop-mode-tools.git] / laptop-mode-tools.spec
1 #
2 # Conditional build:
3 %bcond_with     apm     # build apm package
4 %bcond_without  acpi    # build acpi package
5
6 # TODO:
7 # - subpackage with files for pbbuttonsd and pmud
8 # - fix *.conf manuals (should be .5 and referenced as such)
9 # - /etc/apm not owned, should it be /etc/pm?
10
11 %ifnarch %{ix86} %{x8664} ia64
12 %undefine               with_acpi
13 %endif
14 %ifnarch %{ix86} %{arm} mips ppc sh
15 %undefine               with_apm
16 %endif
17 Summary:        Laptop Mode Tools
18 Summary(pl.UTF-8):      Narzędzia do trybu laptopowego
19 Name:           laptop-mode-tools
20 Version:        1.72.2
21 Release:        2
22 License:        GPL
23 Group:          Applications/System
24 Source0:        https://github.com/rickysarraf/laptop-mode-tools/archive/%{version}/%{name}-%{version}.tar.gz
25 # Source0-md5:  8a7b3658b0137ce893fe6a224fffd7ba
26 Source1:        %{name}.init
27 Patch0:         no-exec-redirection.patch
28 Patch1:         cpufreq-pstate.patch
29 Patch2:         intel_perf_bias.patch
30 URL:            https://github.com/rickysarraf/laptop-mode-tools
31 BuildRequires:  rpm-pythonprov
32 BuildRequires:  rpmbuild(macros) >= 1.714
33 Requires(post,preun):   /sbin/chkconfig
34 %if %{with apm} && %{with acpi}
35 Requires:       %{name}-scripts = %{version}-%{release}
36 %else
37 %{?with_acpi:Requires:  acpid}
38 %{?with_apm:Requires:   apmd}
39 Obsoletes:      laptop-mode-tools-acpi < %{version}-%{release}
40 Obsoletes:      laptop-mode-tools-apm < %{version}-%{release}
41 Obsoletes:      laptop-mode-tools-scripts < %{version}-%{release}
42 %endif
43 Suggests:       hdparm
44 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46 %description
47 Laptop mode (also known as laptopmode, laptop-mode and laptop_mode,
48 for search engine purposes :) ) is a kernel "mode" that allows you to
49 extend the battery life of your laptop. It does this by intelligently
50 grouping write activity on your disks, so that only reads of uncached
51 data result in a disk spinup. It causes a significant improvement in
52 battery life (for usage patterns that allow it).
53
54 %description -l pl.UTF-8
55 Tryb laptopowy (laptop mode) to "tryb" pracy jądra umożliwiający
56 wydłużenie czasu życia baterii laptopa. Czyni to inteligentnie
57 grupując zapisy na dyski w ten sposób, że tylko odczyt
58 niezbuforowanych danych powoduje rozpędzenie dysku. Powoduje znaczącą
59 poprawę czasu życia baterii.
60
61 %package acpi
62 Summary:        ACPI scripts for laptop mode tools
63 Summary(pl.UTF-8):      Skrypty ACPI dla narzędzi do trybu laptopowego
64 Group:          Applications/System
65 Requires:       %{name} = %{version}-%{release}
66 Requires:       acpid
67 Provides:       %{name}-scripts = %{version}-%{release}
68
69 %description acpi
70 ACPI scripts for laptop mode tools.
71
72 %description acpi -l pl.UTF-8
73 Skrypty ACPI dla narzędzi do trybu laptopowego.
74
75 %package apm
76 Summary:        APM scripts for laptop mode tools
77 Summary(pl.UTF-8):      Skrypty APM dla narzędzi do trybu laptopowego
78 Group:          Applications/System
79 Requires:       %{name} = %{version}-%{release}
80 Requires:       apmd
81 Provides:       %{name}-scripts = %{version}-%{release}
82
83 %description apm
84 APM scripts for laptop mode tools.
85
86 %description apm -l pl.UTF-8
87 Skrypty APM dla narzędzi do trybu laptopowego.
88
89 %package -n pm-utils-lmt
90 Summary:        Laptop mode tools script for pm-utils
91 Group:          Applications/System
92 Requires:       %{name} = %{version}-%{release}
93 Requires:       pm-utils
94
95 %description -n pm-utils-lmt
96 Laptop mode tools script for pm-utils.
97
98 %package gui
99 Summary:        GUI for laptop mode tools
100 Summary(pl.UTF-8):      GUI dla narzędzi do trybu laptopowego
101 Group:          Applications/X11
102 Requires:       python-PyQt4
103 Requires:       python-modules
104 Requires:       %{name} = %{version}-%{release}
105 BuildArch:      noarch
106
107 %description gui
108 GUI for laptop mode tools.
109
110 %description gui -l pl.UTF-8
111 GUI dla narzędzi do trybu laptopowego.
112
113 %prep
114 %setup -q
115 %patch0 -p1
116 %patch1 -p1
117 %patch2 -p1
118
119 %{__sed} -i -e 's|/usr/bin/env python2|/usr/bin/python|' gui/LMT.py
120
121 %install
122 rm -rf $RPM_BUILD_ROOT
123 install -d $RPM_BUILD_ROOT{%{_bindir},%{_desktopdir}}
124
125 %{__make} install \
126         INSTALL=install \
127         INIT_D=$RPM_BUILD_ROOT/etc/rc.d/init.d \
128         ULIB_D=%{_libdir} \
129         MAN_D=%{_mandir} \
130         TMPFILES_D=%{systemdtmpfilesdir} \
131         %{!?with_acpi:ACPI=disabled} \
132         %{!?with_apm:APM=disabled} \
133         DESTDIR=$RPM_BUILD_ROOT
134
135 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/laptop-mode
136
137 %{__mv} $RPM_BUILD_ROOT%{_datadir}/%{name}/{LMT,lmt}.py
138
139 %clean
140 rm -rf $RPM_BUILD_ROOT
141
142 %post
143 /sbin/chkconfig --add laptop-mode
144 %service laptop-mode restart
145
146 %preun
147 if [ "$1" = "0" ]; then
148         %service laptop-mode stop
149         /sbin/chkconfig --del laptop-mode
150 fi
151
152 %files
153 %defattr(644,root,root,755)
154 %doc README.md Documentation/*
155 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/*.conf
156 %dir %{_sysconfdir}/laptop-mode
157 %dir %{_sysconfdir}/laptop-mode/batt-start
158 %dir %{_sysconfdir}/laptop-mode/batt-stop
159 %dir %{_sysconfdir}/laptop-mode/conf.d
160 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/conf.d/*.conf
161 %dir %{_sysconfdir}/laptop-mode/lm-ac-start
162 %dir %{_sysconfdir}/laptop-mode/lm-ac-stop
163 %dir %{_sysconfdir}/laptop-mode/nolm-ac-start
164 %dir %{_sysconfdir}/laptop-mode/nolm-ac-stop
165 %attr(754,root,root) /etc/rc.d/init.d/laptop-mode
166 %attr(755,root,root) /lib/udev/lmt-udev
167 /lib/udev/rules.d/99-laptop-mode.rules
168 %{systemdtmpfilesdir}/laptop-mode.conf
169 %{systemdunitdir}/laptop-mode.service
170 %{systemdunitdir}/laptop-mode.timer
171 %{systemdunitdir}/lmt-poll.service
172 %dir %{_datadir}/%{name}
173 %dir %{_datadir}/%{name}/modules
174 %attr(755,root,root) %{_datadir}/%{name}/modules/*
175 %dir %{_datadir}/%{name}/module-helpers
176 %attr(755,root,root) %{_datadir}/%{name}/module-helpers/*
177 %attr(755,root,root) %{_sbindir}/laptop_mode
178 %attr(755,root,root) %{_sbindir}/lm-profiler
179 %attr(755,root,root) %{_sbindir}/lm-syslog-setup
180 %{_mandir}/man8/laptop_mode.8*
181 %{_mandir}/man8/lm-profiler.8*
182 %{_mandir}/man8/lm-syslog-setup.8*
183 # should be man5
184 %{_mandir}/man8/laptop-mode.conf.8*
185 %{_mandir}/man8/lm-profiler.conf.8*
186
187 %if %{with acpi}
188 # skip subpackage if only one backend built
189 %{?with_apm:%files acpi}
190 %defattr(644,root,root,755)
191 %attr(755,root,root) %{_sysconfdir}/acpi/actions/lm_*.sh
192 %{_sysconfdir}/acpi/events/lm_*
193 %endif
194
195 %if %{with apm}
196 # skip subpackage if only one backend built
197 %{?with_acpi:%files apm}
198 %defattr(644,root,root,755)
199 # XXX: dir not owned
200 %attr(755,root,root) %{_sysconfdir}/apm/event.d/laptop-mode
201 %endif
202
203 %files -n pm-utils-lmt
204 %defattr(644,root,root,755)
205 %attr(755,root,root) %{_libdir}/pm-utils/sleep.d/01laptop-mode
206
207 %files gui
208 %defattr(644,root,root,755)
209 %attr(755,root,root) %{_sbindir}/lmt-config-gui
210 %attr(755,root,root) %{_sbindir}/lmt-config-gui-pkexec
211 %{_datadir}/%{name}/lmt.py
212 %{_datadir}/polkit-1/actions/org.linux.lmt.gui.policy
213 %{_desktopdir}/laptop-mode-tools.desktop
214 %{_pixmapsdir}/laptop-mode-tools.svg
This page took 0.084502 seconds and 3 git commands to generate.