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