]> git.pld-linux.org Git - packages/cpufreqd.git/blob - cpufreqd.spec
74ed0659d9c69b5b773a6e16ea9fcacd84d7e4b8
[packages/cpufreqd.git] / cpufreqd.spec
1 # TODO:
2 # - loading modules in init-script, if needed
3 # - prepare upgrade to 2.x with plugins scheme
4 Summary:        Scales your cpu frequency
5 Summary(pl):    Skalowanie czêstotliwo¶ci procesora
6 Name:           cpufreqd
7 Version:        2.0.0
8 Release:        0.1
9 License:        GPL v2
10 Group:          Applications/System
11 Source0:        http://dl.sourceforge.net/cpufreqd/%{name}-%{version}.tar.bz2
12 # Source0-md5:  26a6e0795624114cc15aa48ad8b6ca6b
13 Source1:        %{name}.init
14 Patch0:         %{name}-am.patch
15 URL:            http://cpufreqd.sourceforge.net/
16 BuildRequires:  autoconf
17 BuildRequires:  automake
18 BuildRequires:  cpufrequtils-devel
19 BuildRequires:  libtool
20 PreReq:         rc-scripts
21 Requires(post,preun):   /sbin/chkconfig
22 Requires(post): sed
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %description
26 This daemon monitors /proc/apm for the battery status and scales your
27 cpu frequency according to a set of rules. It is very useful for
28 providing maximum battery life but good cpu speed at the same time.
29
30 %description -l pl
31 Ten demon monitoruje stan baterii przez /proc/apm i skaluje
32 czêstotliwo¶æ procesora zgodnie z zestawem regu³. Jest bardzo
33 przydatny do zapewniania maksymalnego czasu ¿ycia baterii, a
34 jednocze¶nie dobrej szybko¶ci procesora.
35
36 %prep
37 %setup -q
38 %patch0 -p1
39
40 %build
41 %{__libtoolize}
42 %{__aclocal}
43 %{__autoconf}
44 %{__automake}
45 %configure \
46         --libdir=%{_libdir}/%{name}
47 %{__make}
48
49 %install
50 rm -rf $RPM_BUILD_ROOT
51 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
52
53 %{__make} install \
54         DESTDIR=$RPM_BUILD_ROOT
55
56 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
57
58 %clean
59 rm -rf $RPM_BUILD_ROOT
60
61 %post
62 /sbin/chkconfig --add cpufreqd
63
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         cat /etc/cpufreqd.conf | sed -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                                         /etc/cpufreqd.conf
76 fi
77
78 if [ -f /var/lock/subsys/cpufreqd ]; then
79         /etc/rc.d/init.d/cpufreqd restart >&2
80 else
81         echo "Run \"/etc/rc.d/init.d/cpufreqd start\" to start CPU FREQ daemon."
82 fi
83
84 %preun
85 if [ "$1" = "0" ]; then
86         if [ -f /var/lock/subsys/cpufreqd ]; then
87                 /etc/rc.d/init.d/cpufreqd stop>&2
88         fi
89         /sbin/chkconfig --del cpufreqd
90 fi
91
92 %files
93 %defattr(644,root,root,755)
94 %doc README TODO
95 %attr(754,root,root) %{_sbindir}/*
96 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.conf
97 %{_mandir}/man?/*
98 %attr(754,root,root) /etc/rc.d/init.d/%{name}
99 %dir %{_libdir}/%{name}
100 %attr(755,root,root) %{_libdir}/%{name}/*
This page took 0.04233 seconds and 2 git commands to generate.