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