0fcc85d78c1d4273f9b61a4d4b50f28b62d3104b
[packages/cpufreqd.git] / cpufreqd.spec
1 # TODO:
2 # - loading modules in init-script, if needed
3 # - missing plugin: nvclock, sensors
4 # - move plugins into separate packages? (some is needed, because of additional deps)
5 Summary:        Scales your cpu frequency
6 Summary(pl):    Skalowanie czêstotliwo¶ci procesora
7 Name:           cpufreqd
8 Version:        2.2.0
9 Release:        1
10 License:        GPL v2
11 Group:          Applications/System
12 Source0:        http://dl.sourceforge.net/cpufreqd/%{name}-%{version}.tar.bz2
13 # Source0-md5:  a8916004d3fb75ed43822eb978c08fc5
14 Source1:        %{name}.init
15 URL:            http://cpufreqd.sourceforge.net/
16 BuildRequires:  autoconf
17 BuildRequires:  automake
18 BuildRequires:  cpufrequtils-devel
19 BuildRequires:  libtool
20 BuildRequires:  rpmbuild(macros) >= 1.268
21 BuildRequires:  sysfsutils-devel
22 Requires(post): sed >= 4.0
23 Requires(post,preun):   /sbin/chkconfig
24 Requires:       rc-scripts
25 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26
27 %description
28 This daemon monitors /proc/apm for the battery status and scales your
29 cpu frequency according to a set of rules. It is very useful for
30 providing maximum battery life but good cpu speed at the same time.
31
32 %description -l pl
33 Ten demon monitoruje stan baterii przez /proc/apm i skaluje
34 czêstotliwo¶æ procesora zgodnie z zestawem regu³. Jest bardzo
35 przydatny do zapewniania maksymalnego czasu ¿ycia baterii, a
36 jednocze¶nie dobrej szybko¶ci procesora.
37
38 %prep
39 %setup -q
40
41 %build
42 %{__libtoolize}
43 %{__aclocal}
44 %{__autoconf}
45 %{__automake}
46 %configure \
47         --libdir=%{_libdir}/%{name}
48 %{__make}
49
50 %install
51 rm -rf $RPM_BUILD_ROOT
52 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
53
54 %{__make} install \
55         DESTDIR=$RPM_BUILD_ROOT
56
57 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
58
59 %clean
60 rm -rf $RPM_BUILD_ROOT
61
62 %post
63 if [ "$1" = 1 ]; then
64         # Modify config file for 2.6
65         if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
66                 # translate percentages in integer values
67                 CPUFREQD_MAX_SPEED=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
68                 CPUFREQD_MIN_SPEED=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
69                 CPUFREQD_MHIGH_SPEED=$(( $CPUFREQD_MAX_SPEED / 100 * 66 ))
70                 CPUFREQD_MLOW_SPEED=$(( $CPUFREQD_MAX_SPEED / 100 * 33 ))
71                 sed -i -e "s/100%/$CPUFREQD_MAX_SPEED/; \
72                         s/66%/$CPUFREQD_MHIGH_SPEED/; \
73                         s/33%/$CPUFREQD_MLOW_SPEED/;  \
74                         s/0%/$CPUFREQD_MIN_SPEED/;" \
75                         %{_sysconfdir}/cpufreqd.conf
76         fi
77 fi
78
79 /sbin/chkconfig --add cpufreqd
80 %service cpufreqd restart "CPU FREQ daemon"
81
82 %preun
83 if [ "$1" = "0" ]; then
84         %service cpufreqd stop
85         /sbin/chkconfig --del cpufreqd
86 fi
87
88 %files
89 %defattr(644,root,root,755)
90 %doc README TODO
91 %attr(754,root,root) %{_sbindir}/*
92 %attr(755,root,root) %{_bindir}/*
93 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.conf
94 %{_mandir}/man?/*
95 %attr(754,root,root) /etc/rc.d/init.d/%{name}
96 %dir %{_libdir}/%{name}
97 %attr(755,root,root) %{_libdir}/%{name}/*
This page took 0.041038 seconds and 2 git commands to generate.