]> git.pld-linux.org Git - packages/laptop-mode-tools.git/blob - laptop-mode-tools.spec
69d92bcd0002aad84c6ff8cfa9dd4ee59afc01cd
[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.58
21 Release:        2
22 License:        GPL
23 Group:          Applications/System
24 Source0:        http://samwel.tk/laptop_mode/tools/downloads/%{name}_%{version}.tar.gz
25 # Source0-md5:  c7a234ada284eaaece0e04bd260e87af
26 Source1:        %{name}.init
27 Source2:        %{name}.tmpfiles
28 Patch0:         %{name}-kver.patch
29 URL:            http://www.samwel.tk/laptop_mode/
30 BuildRequires:  rpmbuild(macros) >= 1.268
31 Requires(post,preun):   /sbin/chkconfig
32 %if %{with apm} && %{with acpi}
33 Requires:       %{name}-scripts = %{version}-%{release}
34 %else
35 %{?with_acpi:Requires:  acpid}
36 %{?with_apm:Requires:   apmd}
37 Obsoletes:      laptop-mode-tools-scripts
38 %endif
39 Suggests:       hdparm
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 Laptop mode (also known as laptopmode, laptop-mode and laptop_mode,
44 for search engine purposes :) ) is a kernel "mode" that allows you to
45 extend the battery life of your laptop. It does this by intelligently
46 grouping write activity on your disks, so that only reads of uncached
47 data result in a disk spinup. It causes a significant improvement in
48 battery life (for usage patterns that allow it).
49
50 %description -l pl.UTF-8
51 Tryb laptopowy (laptop mode) to "tryb" pracy jądra umożliwiający
52 wydłużenie czasu życia baterii laptopa. Czyni to inteligentnie
53 grupując zapisy na dyski w ten sposób, że tylko odczyt
54 niezbuforowanych danych powoduje rozpędzenie dysku. Powoduje znaczącą
55 poprawę czasu życia baterii.
56
57 %package acpi
58 Summary:        ACPI scripts for laptop mode tools
59 Summary(pl.UTF-8):      Skrypty ACPI dla narzędzi do trybu laptopowego
60 Group:          Applications/System
61 Requires:       %{name} = %{version}-%{release}
62 Requires:       acpid
63 Provides:       %{name}-scripts = %{version}-%{release}
64
65 %description acpi
66 ACPI scripts for laptop mode tools.
67
68 %description acpi -l pl.UTF-8
69 Skrypty ACPI dla narzędzi do trybu laptopowego.
70
71 %package apm
72 Summary:        APM scripts for laptop mode tools
73 Summary(pl.UTF-8):      Skrypty APM dla narzędzi do trybu laptopowego
74 Group:          Applications/System
75 Requires:       %{name} = %{version}-%{release}
76 Requires:       apmd
77 Provides:       %{name}-scripts = %{version}-%{release}
78
79 %description apm
80 APM scripts for laptop mode tools.
81
82 %description apm -l pl.UTF-8
83 Skrypty APM dla narzędzi do trybu laptopowego.
84
85 %prep
86 %setup -q -n %{name}_%{version}
87 %patch0 -p1
88
89 %install
90 rm -rf $RPM_BUILD_ROOT
91 install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d} \
92         $RPM_BUILD_ROOT{%{_mandir}/man8,%{_datadir}/%{name}/modules,%{_sbindir}} \
93         $RPM_BUILD_ROOT%{_sysconfdir}/laptop-mode/{{batt,lm-ac,nolm-ac}-{start,stop},conf.d} \
94         $RPM_BUILD_ROOT%{_varrun}/%{name} \
95         $RPM_BUILD_ROOT/usr/lib/tmpfiles.d
96
97 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/laptop-mode
98 cp -a etc/laptop-mode/*.conf $RPM_BUILD_ROOT%{_sysconfdir}/laptop-mode
99 cp -a etc/laptop-mode/conf.d/*.conf $RPM_BUILD_ROOT%{_sysconfdir}/laptop-mode/conf.d
100 install usr/share/laptop-mode-tools/modules/* $RPM_BUILD_ROOT%{_datadir}/%{name}/modules
101 install -p usr/sbin/{laptop_mode,lm-syslog-setup,lm-profiler} $RPM_BUILD_ROOT%{_sbindir}
102 cp -a man/*.8 $RPM_BUILD_ROOT%{_mandir}/man8
103
104 install %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
105
106 %if %{with acpi}
107 install -d $RPM_BUILD_ROOT/etc/acpi/{actions,events}
108 install -p etc/acpi/actions/* $RPM_BUILD_ROOT/etc/acpi/actions
109 install -p etc/acpi/events/* $RPM_BUILD_ROOT/etc/acpi/events
110 %endif
111
112 %if %{with apm}
113 install -d $RPM_BUILD_ROOT/etc/apm/event.d
114 install -p etc/apm/event.d/* $RPM_BUILD_ROOT/etc/apm/event.d
115 %endif
116
117 %clean
118 rm -rf $RPM_BUILD_ROOT
119
120 %post
121 /sbin/chkconfig --add laptop-mode
122 %service laptop-mode restart
123
124 %preun
125 if [ "$1" = "0" ]; then
126         %service laptop-mode stop
127         /sbin/chkconfig --del laptop-mode
128 fi
129
130 %files
131 %defattr(644,root,root,755)
132 %doc README Documentation/*
133 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/*.conf
134 %dir %{_sysconfdir}/laptop-mode
135 %dir %{_sysconfdir}/laptop-mode/batt-start
136 %dir %{_sysconfdir}/laptop-mode/batt-stop
137 %dir %{_sysconfdir}/laptop-mode/conf.d
138 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/laptop-mode/conf.d/*.conf
139 %dir %{_sysconfdir}/laptop-mode/lm-ac-start
140 %dir %{_sysconfdir}/laptop-mode/lm-ac-stop
141 %dir %{_sysconfdir}/laptop-mode/nolm-ac-start
142 %dir %{_sysconfdir}/laptop-mode/nolm-ac-stop
143 %attr(754,root,root) /etc/rc.d/init.d/laptop-mode
144 %dir %{_datadir}/%{name}
145 %dir %{_datadir}/%{name}/modules
146 %dir %{_varrun}/%{name}
147 /usr/lib/tmpfiles.d/%{name}.conf
148 %attr(755,root,root) %{_datadir}/%{name}/modules/*
149 %attr(755,root,root) %{_sbindir}/laptop_mode
150 %attr(755,root,root) %{_sbindir}/lm-profiler
151 %attr(755,root,root) %{_sbindir}/lm-syslog-setup
152 %{_mandir}/man8/laptop_mode.8*
153 %{_mandir}/man8/lm-profiler.8*
154 %{_mandir}/man8/lm-syslog-setup.8*
155 # should be man5
156 %{_mandir}/man8/laptop-mode.conf.8*
157 %{_mandir}/man8/lm-profiler.conf.8*
158
159 %if %{with acpi}
160 # skip subpackage if only one backend built
161 %{?with_apm:%files acpi}
162 %defattr(644,root,root,755)
163 %attr(755,root,root) %{_sysconfdir}/acpi/actions/lm_*.sh
164 %{_sysconfdir}/acpi/events/lm_*
165 %endif
166
167 %if %{with apm}
168 # skip subpackage if only one backend built
169 %{?with_acpi:%files apm}
170 %defattr(644,root,root,755)
171 # XXX: dir not owned
172 %attr(755,root,root) %{_sysconfdir}/apm/event.d/laptop-mode
173 %endif
This page took 0.041816 seconds and 3 git commands to generate.