~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/src/initscripts/etc/init.d/halt

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2009-09-13 00:13:49 UTC
  • Revision ID: james.westby@ubuntu.com-20090913001349-c4hnvhp0titxdpw9
Tags: 2.87dsf-5
* Uploading to experimental, to test the new build rules.

* Make sysv-rc postinst report detected problems to stderr too when
  failing to migrate.
* Fix typo in error message from postinst (Closes: #545409).
* Make initscripts depend on sysvinit-utils (>= 2.86.ds1-64), to
  make sure the fstab-decode program is available (Closes: #545356).
* Make sure the calls to 'update-rc.d X remove' in initscripts
  postinst do not ignore errors (Closes: #406361).
* Make sysvinit depend on sysvinit-utils (>= 2.86.ds1-66) to avoid
  that bootlogd disappear during partial upgrades (Closes: #545368).
* Restructure source package to make it possible to use debhelper in
  the common way to build the source, by moving debian/initscripts/
  and debian/sysv-rc/ into debian/src/.  Restructure build rules to
  use debhelper more, and migrate to debhelper 7.
* New patch 98_installtarget.patch to improve the sysvinit install
  target.
* Remove /etc/init.d/.depend.* in prerm, not postrm, to avoid
  surprises.
* Remove /var/lib/update-rc.d/* when the package is purged.
* Change cut-off point for the trimmed changelog entries in
  sysvinit-utils, initscripts and sysv-rc from version 2.84-3 to
  version 2.86.ds1-47, to reduce the package sizes.
* Drop hurd specific dependency on libc0.3 (>= 2.3.2.ds1-12).  It is
  no longer needed according to Michael Bunk.  Patch from Michael
  Biebl.
* Remove information about scripts in /var/lib/update-rc.d/ when
  their runlevel symlinks are removed (Closes: #545949).  Remove
  such files left behind earlier during upgrade.
* Bootlogd now starts as late as possible (Closes: #265801)
* Drop the binary /lib/init/readlink from initscripts and depend on
  coreutils (>= 5.93) instead.  Adjust scripts to use the program
  from coreutils from now on (Closes: #239342).
* Make sure insserv exit values propagate through update-rc.d to make
  sure packages with errors fail to install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
### BEGIN INIT INFO
 
3
# Provides:          halt
 
4
# Required-Start:
 
5
# Required-Stop:
 
6
# Default-Start:
 
7
# Default-Stop:      0
 
8
# Short-Description: Execute the halt command.
 
9
# Description:
 
10
### END INIT INFO
 
11
 
 
12
NETDOWN=yes
 
13
 
 
14
PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
15
[ -f /etc/default/halt ] && . /etc/default/halt
 
16
 
 
17
. /lib/lsb/init-functions
 
18
 
 
19
do_stop () {
 
20
        if [ "$INIT_HALT" = "" ]
 
21
        then
 
22
                case "$HALT" in
 
23
                  [Pp]*)
 
24
                        INIT_HALT=POWEROFF
 
25
                        ;;
 
26
                  [Hh]*)
 
27
                        INIT_HALT=HALT
 
28
                        ;;
 
29
                  *)
 
30
                        INIT_HALT=POWEROFF
 
31
                        ;;
 
32
                esac
 
33
        fi
 
34
 
 
35
        # See if we need to cut the power.
 
36
        if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
 
37
        then
 
38
                /etc/init.d/ups-monitor poweroff
 
39
        fi
 
40
 
 
41
        # Don't shut down drives if we're using RAID.
 
42
        hddown="-h"
 
43
        if grep -qs '^md.*active' /proc/mdstat
 
44
        then
 
45
                hddown=""
 
46
        fi
 
47
 
 
48
        # If INIT_HALT=HALT don't poweroff.
 
49
        poweroff="-p"
 
50
        if [ "$INIT_HALT" = "HALT" ]
 
51
        then
 
52
                poweroff=""
 
53
        fi
 
54
 
 
55
        # Make it possible to not shut down network interfaces,
 
56
        # needed to use wake-on-lan
 
57
        netdown="-i"
 
58
        if [ "$NETDOWN" = "no" ]; then
 
59
                netdown=""
 
60
        fi
 
61
 
 
62
        log_action_msg "Will now halt"
 
63
        halt -d -f $netdown $poweroff $hddown
 
64
}
 
65
 
 
66
case "$1" in
 
67
  start)
 
68
        # No-op
 
69
        ;;
 
70
  restart|reload|force-reload)
 
71
        echo "Error: argument '$1' not supported" >&2
 
72
        exit 3
 
73
        ;;
 
74
  stop)
 
75
        do_stop
 
76
        ;;
 
77
  *)
 
78
        echo "Usage: $0 start|stop" >&2
 
79
        exit 3
 
80
        ;;
 
81
esac
 
82
 
 
83
: