]> git.pld-linux.org Git - packages/laptop-mode-tools.git/blob - laptop-mode-tools.spec
- add support for SATA ALPM
[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.71
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:  8b9a2d9db7dd9d0a99b635a1185f292c
26 Source1:        %{name}.init
27 Patch0:         no-exec-redirection.patch
28 Patch1:         cpufreq-pstate.patch
29 Patch2:         sata-alpm.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-scripts
40 %endif
41 Suggests:       hdparm
42 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44 %description
45 Laptop mode (also known as laptopmode, laptop-mode and laptop_mode,
46 for search engine purposes :) ) is a kernel "mode" that allows you to
47 extend the battery life of your laptop. It does this by intelligently
48 grouping write activity on your disks, so that only reads of uncached
49 data result in a disk spinup. It causes a significant improvement in
50 battery life (for usage patterns that allow it).
51
52 %description -l pl.UTF-8
53 Tryb laptopowy (laptop mode) to "tryb" pracy jądra umożliwiający
54 wydłużenie czasu życia baterii laptopa. Czyni to inteligentnie
55 grupując zapisy na dyski w ten sposób, że tylko odczyt
56 niezbuforowanych danych powoduje rozpędzenie dysku. Powoduje znaczącą
57 poprawę czasu życia baterii.
58
59 %package acpi
60 Summary:        ACPI scripts for laptop mode tools
61 Summary(pl.UTF-8):      Skrypty ACPI dla narzędzi do trybu laptopowego
62 Group:          Applications/System
63 Requires:       %{name} = %{version}-%{release}
64 Requires:       acpid
65 Provides:       %{name}-scripts = %{version}-%{release}
66
67 %description acpi
68 ACPI scripts for laptop mode tools.
69
70 %description acpi -l pl.UTF-8
71 Skrypty ACPI dla narzędzi do trybu laptopowego.
72
73 %package apm
74 Summary:        APM scripts for laptop mode tools
75 Summary(pl.UTF-8):      Skrypty APM dla narzędzi do trybu laptopowego
76 Group:          Applications/System
77 Requires:       %{name} = %{version}-%{release}
78 Requires:       apmd
79 Provides:       %{name}-scripts = %{version}-%{release}
80
81 %description apm
82 APM scripts for laptop mode tools.
83
84 %description apm -l pl.UTF-8
85 Skrypty APM dla narzędzi do trybu laptopowego.
86
87 %package gui
88 Summary:        GUI for laptop mode tools
89 Summary(pl.UTF-8):      GUI dla narzędzi do trybu laptopowego
90 Group:          Applications/X11
91 Requires:       python-PyQt4
92 Requires:       python-modules
93 Requires:       %{name} = %{version}-%{release}
94 %if "%{_rpmversion}" >= "5"
95 BuildArch:      noarch
96 %endif
97
98 %description gui
99 GUI for laptop mode tools.
100
101 %description gui -l pl.UTF-8
102 GUI dla narzędzi do trybu laptopowego.
103
104 %prep
105 %setup -q
106 %patch0 -p1
107 %patch1 -p1
108 %patch2 -p1
109
110 %{__sed} -i -e 's|/usr/bin/env python2|/usr/bin/python|' gui/LMT.py
111
112 %install
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT%{_bindir}
115
116 %{__make} install \
117         INSTALL=install \
118         INIT_D=$RPM_BUILD_ROOT/etc/rc.d/init.d \
119         ULIB_D=%{_libdir} \
120         MAN_D=%{_mandir} \
121         TMPFILES_D=/usr/lib/tmpfiles.d \
122         %{!?with_acpi:ACPI=disabled} \
123         %{!?with_apm:APM=disabled} \
124         DESTDIR=$RPM_BUILD_ROOT
125
126 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/laptop-mode
127
128 install -p gui/LMT.py $RPM_BUILD_ROOT%{_datadir}/%{name}/lmt.py
129 install -p gui/lmt-config-gui $RPM_BUILD_ROOT%{_bindir}/
130
131 %clean
132 rm -rf $RPM_BUILD_ROOT
133
134 %post
135 /sbin/chkconfig --add laptop-mode
136 %service laptop-mode restart
137
138 %preun
139 if [ "$1" = "0" ]; then
140         %service laptop-mode stop
141         /sbin/chkconfig --del laptop-mode
142 fi
143
144 %files
145 %defattr(644,root,root,755)
146 %doc README.md Documentation/*
147 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/*.conf
148 %dir %{_sysconfdir}/laptop-mode
149 %dir %{_sysconfdir}/laptop-mode/batt-start
150 %dir %{_sysconfdir}/laptop-mode/batt-stop
151 %dir %{_sysconfdir}/laptop-mode/conf.d
152 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/conf.d/*.conf
153 %dir %{_sysconfdir}/laptop-mode/lm-ac-start
154 %dir %{_sysconfdir}/laptop-mode/lm-ac-stop
155 %dir %{_sysconfdir}/laptop-mode/nolm-ac-start
156 %dir %{_sysconfdir}/laptop-mode/nolm-ac-stop
157 %attr(754,root,root) /etc/rc.d/init.d/laptop-mode
158 %attr(755,root,root) /lib/udev/lmt-udev
159 /lib/udev/rules.d/99-laptop-mode.rules
160 /usr/lib/tmpfiles.d/laptop-mode.conf
161 /lib/systemd/system/laptop-mode.service
162 /lib/systemd/system/laptop-mode.timer
163 /lib/systemd/system/lmt-poll.service
164 %dir %{_libdir}/pm-utils/sleep.d
165 %attr(755,root,root) %{_libdir}/pm-utils/sleep.d/01laptop-mode
166 %dir %{_datadir}/%{name}
167 %dir %{_datadir}/%{name}/modules
168 %attr(755,root,root) %{_datadir}/%{name}/modules/*
169 %dir %{_datadir}/%{name}/module-helpers
170 %attr(755,root,root) %{_datadir}/%{name}/module-helpers/*
171 %attr(755,root,root) %{_sbindir}/laptop_mode
172 %attr(755,root,root) %{_sbindir}/lm-profiler
173 %attr(755,root,root) %{_sbindir}/lm-syslog-setup
174 %{_mandir}/man8/laptop_mode.8*
175 %{_mandir}/man8/lm-profiler.8*
176 %{_mandir}/man8/lm-syslog-setup.8*
177 # should be man5
178 %{_mandir}/man8/laptop-mode.conf.8*
179 %{_mandir}/man8/lm-profiler.conf.8*
180
181 %if %{with acpi}
182 # skip subpackage if only one backend built
183 %{?with_apm:%files acpi}
184 %defattr(644,root,root,755)
185 %attr(755,root,root) %{_sysconfdir}/acpi/actions/lm_*.sh
186 %{_sysconfdir}/acpi/events/lm_*
187 %endif
188
189 %if %{with apm}
190 # skip subpackage if only one backend built
191 %{?with_acpi:%files apm}
192 %defattr(644,root,root,755)
193 # XXX: dir not owned
194 %attr(755,root,root) %{_sysconfdir}/apm/event.d/laptop-mode
195 %endif
196
197 %files gui
198 %defattr(644,root,root,755)
199 %{_datadir}/%{name}/lmt.py
200 %attr(755,root,root) %{_bindir}/lmt-config-gui
201 %{_datadir}/polkit-1/actions/org.linux.lmt.gui.policy
This page took 0.094344 seconds and 3 git commands to generate.