2
# postinst script for cpufreqd
4
# see: dh_installdeb(1)
8
# summary of how this script can be called:
9
# * <postinst> `configure' <most-recently-configured-version>
10
# * <old-postinst> `abort-upgrade' <new version>
11
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
14
# <failed-install-package> <version> `removing'
15
# <conflicting-package> <version>
16
# for details, see http://www.debian.org/doc/debian-policy/ or
17
# the debian-policy package
19
# quoting from the policy:
20
# Any necessary prompting should almost always be confined to the
21
# post-installation script, and should be protected with a conditional
22
# so that unnecessary prompting doesn't happen if a package's
23
# installation fails and the `postinst' is called with `abort-upgrade',
24
# `abort-remove' or `abort-deconfigure'.
26
# Source debconf library.
27
. /usr/share/debconf/confmodule
31
if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] || [ -f /proc/cpufreq ] ; then
33
[ -z ${CPUFREQD_PM} ] || unset CPUFREQD_PM
35
if [ -d /proc/pmu ]; then
37
elif [ -f /proc/apm ]; then
39
elif [ -d /proc/acpi ]; then
44
if [ ${CPUFREQD_PM} ]; then
46
# # Modify config file for 2.6
47
# if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
49
# # translate percentages in integer values
50
# CPUFREQD_MAX_SPEED=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
51
# CPUFREQD_MIN_SPEED=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
52
# CPUFREQD_SPEED_DIFF=$(( $CPUFREQD_MAX_SPEED - $CPUFREQD_MIN_SPEED))
53
# CPUFREQD_MHIGH_SPEED=$(( $CPUFREQD_MIN_SPEED + ($CPUFREQD_SPEED_DIFF / 100 * 66) ))
54
# CPUFREQD_MLOW_SPEED=$(( $CPUFREQD_MIN_SPEED + ($CPUFREQD_SPEED_DIFF / 100 * 33) ))
56
# sed -i -e "s/100%/$CPUFREQD_MAX_SPEED/; \
57
# s/66%/$CPUFREQD_MHIGH_SPEED/; \
58
# s/33%/$CPUFREQD_MLOW_SPEED/; \
59
# s/0%/$CPUFREQD_MIN_SPEED/;" \
64
# setup a very simple default configuration file
65
sed -i -e "s/^\(pm_type=\)acpi\(.*\)/\1$CPUFREQD_PM\2/" /etc/cpufreqd.conf
67
update-rc.d cpufreqd defaults > /dev/null
69
if [ -x /usr/sbin/invoke-rc.d ] ; then
70
invoke-rc.d cpufreqd start
72
/etc/init.d/cpufreqd start
79
# warn the user about not finding cpufreq kernel interface
83
abort-upgrade|abort-remove|abort-deconfigure)
88
echo "postinst called with unknown argument \`$1'" >&2
95
# dh_installdeb will replace this with shell code automatically
96
# generated by other debhelper scripts.