~tormodvolden/ubuntu/karmic/laptop-mode-tools/dupl-hook

« back to all changes in this revision

Viewing changes to usr/share/laptop-mode-tools/modules/syslog-conf

  • Committer: Bazaar Package Importer
  • Author(s): Tormod Volden
  • Date: 2008-05-12 16:24:50 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080512162450-n0lm5jnbafdf89l0
Tags: 1.42-1ubuntu1
* Merge from debian unstable (LP: #229579), remaining changes:
  - etc/init.d/laptop-mode: Check if laptop mode is disabled in
    /etc/default/laptop-mode (that's the file laptop_mode looks into, too,
    but it incorrectly evaluates the ENABLE_LAPTOP_MODE setting) as well
    as in /etc/default/acpi-support.
  - /usr/sbin/laptop_mode: Do not parse arguments, ignore "force" and
    "init" and let start/stop mean enable/disable.
  - /usr/sbin/laptop_mode: Do not read $ACTIVATE_WITH_POSSIBLE_DATA_LOSS
    from /var/run/laptop-mode-state to see if state has changed.
  - debian/rules: Do not ship acpi/apm scripts (we handle that ourselves)
  - debian/laptop-mode-tools.preinst: Remove any old acpi/apm scripts
  - debian/laptop-mode-tools.postinst: Create /etc/default/laptop-mode
    (with ENABLE_LAPTOP_MODE=false) if the file does not exist yet and we
    are on ppc.
  - debian/control: Change maintainer
* Use #DEBHELPER# in .postinst and .preinst (LP: #226788)
* Avoid using temporary files in init script to avoid hangs on
  shutdown if filesystem is read-only (LP: #206217)
* Also accept "stop" as second argument since the init script
  calls laptop_mode with "init stop"

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# Laptop mode tools module: syslog.conf switching functionality (DEPRECATED)
 
4
#
 
5
#
 
6
# This module implements the old syslog.conf functionality -- deprecated but
 
7
# still supported for backward compatibility.
 
8
 
9
 
 
10
 
 
11
 
 
12
if [ $CONTROL_SYSLOG_CONF -eq 1 ] ; then
 
13
        echo "Adjusting syslog configuration." >> $OUTPUT
 
14
        if [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
 
15
                echo "$SYSLOG_CONF is a symlink." >> $OUTPUT
 
16
                if [ ! -f "$SYSLOG_CONF.no-lm" ] ; then
 
17
                        echo "But there is no $SYSLOG_CONF.no-lm. This must have been done by an earlier" >> $OUTPUT
 
18
                        echo "version of laptop-mode-tools." >> $OUTPUT
 
19
                        echo "Creating it now from $NOLM_AC_SYSLOG_CONF."
 
20
                        cp "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
 
21
                fi
 
22
        else
 
23
                echo "$SYSLOG_CONF is not a symlink." >> $OUTPUT
 
24
                if [ "$STATE" = "enabled" ] ; then
 
25
                        echo "Saving it to $SYSLOG_CONF.no-lm." >> $OUTPUT
 
26
                        cp --backup=numbered "$SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
 
27
                fi
 
28
        fi
 
29
 
 
30
        if [ "$STATE" != "enabled" ] ; then
 
31
                echo "Laptop mode is not enabled. Restoring $SYSLOG_CONF." >> $OUTPUT
 
32
                if [ -f "$SYSLOG_CONF.no-lm" ] ; then
 
33
                        mv "$SYSLOG_CONF.no-lm" "$SYSLOG_CONF"
 
34
                elif [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
 
35
                        echo "ERROR: $SYSLOG_CONF is a symlink but $SYSLOG_CONF.no-lm is not present."
 
36
                fi
 
37
        elif [ $ON_AC -eq 1 ] ; then
 
38
                if [ "$ACTIVATE" -eq 1 ] ; then
 
39
                        echo "Setting syslog config to $LM_AC_SYSLOG_CONF." >> $OUTPUT
 
40
                        ln -fs "$LM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
 
41
                else
 
42
                        echo "Setting syslog config to $NOLM_AC_SYSLOG_CONF." >> $OUTPUT
 
43
                        ln -fs "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
 
44
                fi
 
45
        else
 
46
                echo "Setting syslog config to $BATT_SYSLOG_CONF." >> $OUTPUT
 
47
                ln -fs "$BATT_SYSLOG_CONF" "$SYSLOG_CONF"
 
48
        fi
 
49
        # Notify syslogd of configuration change.
 
50
        if [ "$SYSLOG_CONF_SIGNAL_PROGRAM" != "" ] ; then
 
51
                echo "Sending SIGHUP to all $SYSLOG_CONF_SIGNAL_PROGRAM processes." >> $OUTPUT
 
52
                killall -q -HUP $SYSLOG_CONF_SIGNAL_PROGRAM
 
53
        fi
 
54
fi
 
55