~ubuntu-branches/ubuntu/dapper/cpufreqd/dapper

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Bazaar Package Importer
  • Author(s): Mattia Dongili
  • Date: 2005-11-27 18:47:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127184742-9h26euwetr6kh1e6
Tags: 2.0.0-1

* New upstream release.
* cpufreqd.init: exit succesfully in case a stop is issued and
  cpufreqd is found running as requested by LSB thus making it
  possible to remove cpufreqd when cpufreqd itsef is stopped
  (closes: #340133)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
# Source debconf library.
27
27
. /usr/share/debconf/confmodule
28
28
 
 
29
check_for_cpufreq_support() {
 
30
        # forget it if we're trying to start and no cpufreq found in kernel
 
31
        if !([ -d /sys/devices/system/cpu/cpu0/cpufreq ] || [ -f /proc/cpufreq ]) ; then
 
32
                echo -n "No cpufreq interface found, "
 
33
                return 1
 
34
        fi
 
35
        return 0
 
36
}
 
37
 
 
38
check_for_pm_support() {
 
39
        # forget it if we're trying to start and no power management support is
 
40
        # included in kernel
 
41
        if !([ -d /proc/pmu ] || [ -f /proc/apm ] || [ -d /proc/acpi ]) ; then
 
42
                echo -n "No supported power management interface found, "
 
43
                return 1
 
44
        fi
 
45
        return 0
 
46
}
 
47
 
29
48
case "$1" in
30
49
    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
 
            # setup a very simple default configuration file
46
 
            sed -i -e "s/^\(pm_type=\)acpi\(.*\)/\1$CPUFREQD_PM\2/" /etc/cpufreqd.conf
47
 
 
48
 
          fi
49
 
 
50
 
        fi
51
 
 
52
50
        # setup startup links, they'll warn the user of anything not being setup properly
53
51
        update-rc.d cpufreqd defaults > /dev/null
54
 
        if [ -x /usr/sbin/invoke-rc.d ] ; then
55
 
              invoke-rc.d cpufreqd start
56
 
        else
57
 
            /etc/init.d/cpufreqd start
58
 
        fi
 
52
        if ( check_for_cpufreq_support && check_for_pm_support ) ; then
 
53
                if [ -x /usr/sbin/invoke-rc.d ] ; then
 
54
                      invoke-rc.d cpufreqd start
 
55
                else
 
56
                    /etc/init.d/cpufreqd start
 
57
                fi
 
58
        else
 
59
                echo "not starting cpufreqd."
 
60
        fi
59
61
 
60
62
 
61
63
    ;;