~lihow731/ubuntu/saucy/cpufreqd/fix-for-1162160

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Bazaar Package Importer
  • Author(s): Mattia Dongili (ma.d.)
  • Date: 2004-12-18 19:17:37 UTC
  • Revision ID: james.westby@ubuntu.com-20041218191737-l0dqwjebyzow76d6
Tags: 1.2.2-2
  * Renamed debian/po/cz.po into debian/po/cs.po (closes: #285570)
  * Now conflicts with cpudyn and powernowd (closes: #281065)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# postinst script for cpufreqd
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
set -e
 
7
 
 
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>
 
12
#          <new-version>
 
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
 
18
#
 
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'.
 
25
 
 
26
# Source debconf library.
 
27
. /usr/share/debconf/confmodule
 
28
 
 
29
case "$1" in
 
30
    configure)
 
31
        if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] || [ -f /proc/cpufreq ] ; then
 
32
            
 
33
          [ -z ${CPUFREQD_PM} ] || unset CPUFREQD_PM
 
34
 
 
35
          if [ -d /proc/pmu ]; then
 
36
            CPUFREQD_PM=pmu
 
37
          elif [ -f /proc/apm ]; then
 
38
            CPUFREQD_PM=apm
 
39
          elif [ -d /proc/acpi ]; then
 
40
            CPUFREQD_PM=acpi
 
41
          fi
 
42
          
 
43
 
 
44
          if [ ${CPUFREQD_PM} ]; then
 
45
            
 
46
 #           # Modify config file for 2.6
 
47
 #           if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
 
48
 #           
 
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) ))
 
55
 #              
 
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/;" \
 
60
 #                      /etc/cpufreqd.conf
 
61
 #
 
62
 #           fi
 
63
 
 
64
            # setup a very simple default configuration file
 
65
            sed -i -e "s/^\(pm_type=\)acpi\(.*\)/\1$CPUFREQD_PM\2/" /etc/cpufreqd.conf
 
66
 
 
67
            update-rc.d cpufreqd defaults > /dev/null
 
68
 
 
69
            if [ -x /usr/sbin/invoke-rc.d ] ; then
 
70
                  invoke-rc.d cpufreqd start
 
71
            else
 
72
                /etc/init.d/cpufreqd start
 
73
            fi
 
74
 
 
75
          fi
 
76
 
 
77
        fi
 
78
 
 
79
        # warn the user about not finding cpufreq kernel interface
 
80
 
 
81
    ;;
 
82
 
 
83
    abort-upgrade|abort-remove|abort-deconfigure)
 
84
 
 
85
    ;;
 
86
 
 
87
    *)
 
88
        echo "postinst called with unknown argument \`$1'" >&2
 
89
        exit 1
 
90
    ;;
 
91
esac
 
92
 
 
93
db_stop
 
94
 
 
95
# dh_installdeb will replace this with shell code automatically
 
96
# generated by other debhelper scripts.
 
97
 
 
98
#DEBHELPER#
 
99
 
 
100
exit 0
 
101
 
 
102